@galacean/engine-core 1.3.5 → 1.3.7

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.
@@ -2253,7 +2253,7 @@ var size_over_lifetime_module = "#define GLSLIFY 1\n#ifdef RENDERER_SOL_CURVE_MO
2253
2253
 
2254
2254
  var color_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nuniform vec4 renderer_COLMaxGradientColor[4];uniform vec2 renderer_COLMaxGradientAlpha[4];\n#ifdef RENDERER_COL_RANDOM_GRADIENTS\nuniform vec4 renderer_COLMinGradientColor[4];uniform vec2 renderer_COLMinGradientAlpha[4];\n#endif\nuniform vec4 renderer_COLGradientKeysMaxTime;\n#endif\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nvec4 evaluateParticleGradient(in vec4 colorKeys[4],in float colorKeysMaxTime,in vec2 alphaKeys[4],in float alphaKeysMaxTime,in float normalizedAge){vec4 value;float alphaAge=min(normalizedAge,alphaKeysMaxTime);for(int i=0;i<4;i++){vec2 key=alphaKeys[i];float time=key.x;if(alphaAge<=time){if(i==0){value.a=alphaKeys[0].y;}else{vec2 lastKey=alphaKeys[i-1];float lastTime=lastKey.x;float age=(alphaAge-lastTime)/(time-lastTime);value.a=mix(lastKey.y,key.y,age);}break;}}float colorAge=min(normalizedAge,colorKeysMaxTime);for(int i=0;i<4;i++){vec4 key=colorKeys[i];float time=key.x;if(colorAge<=time){if(i==0){value.rgb=colorKeys[0].yzw;}else{vec4 lastKey=colorKeys[i-1];float lastTime=lastKey.x;float age=(colorAge-lastTime)/(time-lastTime);value.rgb=mix(lastKey.yzw,key.yzw,age);}break;}}return value;}\n#endif\nvec4 computeParticleColor(in vec4 color,in float normalizedAge){\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nvec4 gradientColor=evaluateParticleGradient(renderer_COLMaxGradientColor,renderer_COLGradientKeysMaxTime.z,renderer_COLMaxGradientAlpha,renderer_COLGradientKeysMaxTime.w,normalizedAge);\n#endif\n#ifdef RENDERER_COL_RANDOM_GRADIENTS\ngradientColor=mix(evaluateParticleGradient(renderer_COLMinGradientColor,renderer_COLGradientKeysMaxTime.x,renderer_COLMinGradientAlpha,renderer_COLGradientKeysMaxTime.y,normalizedAge),gradientColor,a_Random0.y);\n#endif\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\ncolor*=gradientColor;\n#endif\nreturn color;}"; // eslint-disable-line
2255
2255
 
2256
- var texture_sheet_animation_module = "#define GLSLIFY 1\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nuniform float renderer_TSACycles;uniform vec3 renderer_TSATillingParams;uniform vec2 renderer_TSAFrameMaxCurve[4];\n#endif\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nuniform vec2 renderer_TSAFrameMinCurve[4];\n#endif\nvec2 computeParticleUV(in vec2 uv,in float normalizedAge){\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nfloat scaledNormalizedAge=normalizedAge*renderer_TSACycles;float cycleNormalizedAge=scaledNormalizedAge-floor(scaledNormalizedAge);float normalizedFrame=evaluateParticleCurve(renderer_TSAFrameMaxCurve,cycleNormalizedAge);\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nnormalizedFrame=mix(evaluateParticleCurve(renderer_TSAFrameMinCurve,cycleNormalizedAge),normalizedFrame,a_Random1.x);\n#endif\nfloat frame=floor(normalizedFrame*renderer_TSATillingParams.z);float totalULength=frame*renderer_TSATillingParams.x;float floorTotalULength=floor(totalULength);uv.x+=totalULength-floorTotalULength;uv.y+=floorTotalULength*renderer_TSATillingParams.y;\n#endif\nreturn uv;}"; // eslint-disable-line
2256
+ var texture_sheet_animation_module = "#define GLSLIFY 1\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nuniform float renderer_TSACycles;uniform vec3 renderer_TSATillingParams;uniform vec2 renderer_TSAFrameMaxCurve[4];\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nuniform vec2 renderer_TSAFrameMinCurve[4];\n#endif\n#endif\nvec2 computeParticleUV(in vec2 uv,in float normalizedAge){\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nfloat scaledNormalizedAge=normalizedAge*renderer_TSACycles;float cycleNormalizedAge=scaledNormalizedAge-floor(scaledNormalizedAge);float normalizedFrame=evaluateParticleCurve(renderer_TSAFrameMaxCurve,cycleNormalizedAge);\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nnormalizedFrame=mix(evaluateParticleCurve(renderer_TSAFrameMinCurve,cycleNormalizedAge),normalizedFrame,a_Random1.x);\n#endif\nfloat frame=floor(normalizedFrame*renderer_TSATillingParams.z);float tileRow=frame*renderer_TSATillingParams.x;float floorTotalULength=floor(tileRow);uv.x+=tileRow-tileRowIndex;uv.y+=tileRowIndex*renderer_TSATillingParams.y;\n#endif\nreturn uv;}"; // eslint-disable-line
2257
2257
 
2258
2258
  var sphere_billboard = "#define GLSLIFY 1\n#ifdef RENDERER_MODE_SPHERE_BILLBOARD\nvec2 corner=a_CornerTextureCoordinate.xy+renderer_PivotOffset.xy;vec3 sideVector=normalize(cross(camera_Forward,camera_Up));vec3 upVector=normalize(cross(sideVector,camera_Forward));corner*=computeParticleSizeBillboard(a_StartSize.xy,normalizedAge);\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\nif(renderer_ThreeDStartRotation){vec3 rotation=vec3(a_StartRotation0.xy,computeParticleRotationFloat(a_StartRotation0.z,age,normalizedAge));center+=renderer_SizeScale.xzy*rotationByEuler(corner.x*sideVector+corner.y*upVector,rotation);}else{float rot=computeParticleRotationFloat(a_StartRotation0.x,age,normalizedAge);float c=cos(rot);float s=sin(rot);mat2 rotation=mat2(c,-s,s,c);corner=rotation*corner;center+=renderer_SizeScale.xzy*(corner.x*sideVector+corner.y*upVector);}\n#else\nif(renderer_ThreeDStartRotation){center+=renderer_SizeScale.xzy*rotationByEuler(corner.x*sideVector+corner.y*upVector,a_StartRotation0);}else{float c=cos(a_StartRotation0.x);float s=sin(a_StartRotation0.x);mat2 rotation=mat2(c,-s,s,c);corner=rotation*corner;center+=renderer_SizeScale.xzy*(corner.x*sideVector+corner.y*upVector);}\n#endif\n#endif\n"; // eslint-disable-line
2259
2259
 
@@ -10760,6 +10760,9 @@ var SubRenderElement = /*#__PURE__*/ function() {
10760
10760
  __decorate([
10761
10761
  assignmentClone
10762
10762
  ], SpriteMask.prototype, "influenceLayers", void 0);
10763
+ __decorate([
10764
+ ignoreClone
10765
+ ], SpriteMask.prototype, "_renderElement", void 0);
10763
10766
  __decorate([
10764
10767
  ignoreClone
10765
10768
  ], SpriteMask.prototype, "_subChunk", void 0);
@@ -20930,6 +20933,8 @@ var Collision = function Collision() {
20930
20933
  _this._setUpDirection = _this._setUpDirection.bind(_assert_this_initialized(_this));
20931
20934
  //@ts-ignore
20932
20935
  _this._upDirection._onValueChanged = _this._setUpDirection;
20936
+ // sync world position to physical space
20937
+ _this._onUpdate();
20933
20938
  return _this;
20934
20939
  }
20935
20940
  var _proto = CharacterController.prototype;
@@ -20940,7 +20945,9 @@ var Collision = function Collision() {
20940
20945
  * @param elapsedTime - Time elapsed since last call
20941
20946
  * @return flags - The ControllerCollisionFlag
20942
20947
  */ _proto.move = function move(disp, minDist, elapsedTime) {
20943
- return this._nativeCollider.move(disp, minDist, elapsedTime);
20948
+ var flags = this._nativeCollider.move(disp, minDist, elapsedTime);
20949
+ this._syncWorldPositionFromPhysicalSpace();
20950
+ return flags;
20944
20951
  };
20945
20952
  /**
20946
20953
  * Add collider shape on this controller.
@@ -20976,8 +20983,7 @@ var Collision = function Collision() {
20976
20983
  /**
20977
20984
  * @internal
20978
20985
  */ _proto._onLateUpdate = function _onLateUpdate() {
20979
- var position = this.entity.transform.worldPosition;
20980
- this._nativeCollider.getWorldPosition(position);
20986
+ this._syncWorldPositionFromPhysicalSpace();
20981
20987
  this._updateFlag.flag = false;
20982
20988
  };
20983
20989
  /**
@@ -21000,6 +21006,9 @@ var Collision = function Collision() {
21000
21006
  physics._removeColliderShape(shapes[i]);
21001
21007
  }
21002
21008
  };
21009
+ _proto._syncWorldPositionFromPhysicalSpace = function _syncWorldPositionFromPhysicalSpace() {
21010
+ this._nativeCollider.getWorldPosition(this.entity.transform.worldPosition);
21011
+ };
21003
21012
  _proto._setUpDirection = function _setUpDirection() {
21004
21013
  this._nativeCollider.setUpDirection(this._upDirection);
21005
21014
  };
@@ -28684,7 +28693,9 @@ exports.AnimatorLayerBlendingMode = void 0;
28684
28693
  // Precalculate to get the transition
28685
28694
  srcPlayData.update(playDeltaTime);
28686
28695
  var clipTime = srcPlayData.clipTime, isForwards = srcPlayData.isForwards;
28687
- var transition = this._applyTransitionsByCondition(layerIndex, layerData, layer, state, layer.stateMachine.anyStateTransitions, aniUpdate) || this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, state.transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
28696
+ var transitions = state.transitions;
28697
+ var anyStateTransitions = layer.stateMachine.anyStateTransitions;
28698
+ var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
28688
28699
  var playCostTime;
28689
28700
  if (transition) {
28690
28701
  var clipDuration = state.clip.length;
@@ -28768,7 +28779,7 @@ exports.AnimatorLayerBlendingMode = void 0;
28768
28779
  playedTime - dstPlayDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28769
28780
  playedTime - transitionDuration : dstPlayDeltaTime;
28770
28781
  }
28771
- var actualCostTime = dstPlaySpeed === 0 ? 0 : dstPlayCostTime / dstPlaySpeed;
28782
+ var actualCostTime = dstPlaySpeed === 0 ? deltaTime : dstPlayCostTime / dstPlaySpeed;
28772
28783
  var srcPlayCostTime = actualCostTime * srcPlaySpeed;
28773
28784
  srcPlayData.update(srcPlayCostTime);
28774
28785
  destPlayData.update(dstPlayCostTime);
@@ -28776,6 +28787,7 @@ exports.AnimatorLayerBlendingMode = void 0;
28776
28787
  (crossWeight >= 1.0 - miniprogram.MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
28777
28788
  var crossFadeFinished = crossWeight === 1.0;
28778
28789
  if (crossFadeFinished) {
28790
+ srcPlayData.playState = AnimatorStatePlayState.Finished;
28779
28791
  this._preparePlayOwner(layerData, destState);
28780
28792
  this._evaluatePlayingState(destPlayData, weight, additive, aniUpdate);
28781
28793
  } else {
@@ -28830,7 +28842,7 @@ exports.AnimatorLayerBlendingMode = void 0;
28830
28842
  playedTime - playDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28831
28843
  playedTime - transitionDuration : playDeltaTime;
28832
28844
  }
28833
- var actualCostTime = playSpeed === 0 ? 0 : dstPlayCostTime / playSpeed;
28845
+ var actualCostTime = playSpeed === 0 ? deltaTime : dstPlayCostTime / playSpeed;
28834
28846
  destPlayData.update(dstPlayCostTime);
28835
28847
  var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
28836
28848
  (crossWeight >= 1.0 - miniprogram.MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
@@ -28870,14 +28882,16 @@ exports.AnimatorLayerBlendingMode = void 0;
28870
28882
  }
28871
28883
  };
28872
28884
  _proto._updateFinishedState = function _updateFinishedState(layerIndex, layerData, layer, weight, additive, deltaTime, aniUpdate) {
28873
- var stateMachine = layer.stateMachine;
28885
+ layer.stateMachine;
28874
28886
  var playData = layerData.srcPlayData;
28875
28887
  var state = playData.state;
28876
28888
  var actualSpeed = state.speed * this.speed;
28877
28889
  var actualDeltaTime = actualSpeed * deltaTime;
28878
28890
  playData.updateOrientation(actualDeltaTime);
28879
28891
  var clipTime = playData.clipTime, isForwards = playData.isForwards;
28880
- var transition = this._applyTransitionsByCondition(layerIndex, layerData, layer, state, stateMachine.anyStateTransitions, aniUpdate) || this._applyStateTransitions(layerIndex, layerData, layer, isForwards, playData, state.transitions, clipTime, clipTime, actualDeltaTime, aniUpdate);
28892
+ var transitions = state.transitions;
28893
+ var anyStateTransitions = layer.stateMachine.anyStateTransitions;
28894
+ var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, playData, transitions, clipTime, clipTime, actualDeltaTime, aniUpdate);
28881
28895
  if (transition) {
28882
28896
  this._updateState(layerIndex, layerData, layer, deltaTime, aniUpdate);
28883
28897
  } else {
@@ -32200,7 +32214,6 @@ __decorate([
32200
32214
  function TextureSheetAnimationModule() {
32201
32215
  var _this;
32202
32216
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
32203
- /** Start frame of the texture sheet. */ _this.startFrame = new ParticleCompositeCurve(0);
32204
32217
  /** Frame over time curve of the texture sheet. */ _this.frameOverTime = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
32205
32218
  /** Texture sheet animation type. */ _this.type = /** Animate over the whole texture sheet from left to right, top to bottom. */ 0;
32206
32219
  /** Cycle count. */ _this.cycleCount = 1;
@@ -32230,7 +32243,7 @@ __decorate([
32230
32243
  shaderData.setVector3(TextureSheetAnimationModule._tillingParamsProperty, this._tillingInfo);
32231
32244
  }
32232
32245
  }
32233
- this._textureSheetMacro = this._enableMacro(shaderData, this._textureSheetMacro, frameMacro);
32246
+ this._frameCurveMacro = this._enableMacro(shaderData, this._frameCurveMacro, frameMacro);
32234
32247
  };
32235
32248
  /**
32236
32249
  * @internal
@@ -32260,20 +32273,17 @@ __decorate([
32260
32273
  TextureSheetAnimationModule._frameRandomCurvesMacro = ShaderMacro.getByName("RENDERER_TSA_FRAME_RANDOM_CURVES");
32261
32274
  })();
32262
32275
  (function() {
32263
- TextureSheetAnimationModule._cycleCountProperty = ShaderProperty.getByName("renderer_TSACycles");
32276
+ TextureSheetAnimationModule._frameMinCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMinCurve");
32264
32277
  })();
32265
32278
  (function() {
32266
- TextureSheetAnimationModule._tillingParamsProperty = ShaderProperty.getByName("renderer_TSATillingParams");
32279
+ TextureSheetAnimationModule._frameMaxCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMaxCurve");
32267
32280
  })();
32268
32281
  (function() {
32269
- TextureSheetAnimationModule._frameMinCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMinCurve");
32282
+ TextureSheetAnimationModule._cycleCountProperty = ShaderProperty.getByName("renderer_TSACycles");
32270
32283
  })();
32271
32284
  (function() {
32272
- TextureSheetAnimationModule._frameMaxCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMaxCurve");
32285
+ TextureSheetAnimationModule._tillingParamsProperty = ShaderProperty.getByName("renderer_TSATillingParams");
32273
32286
  })();
32274
- __decorate([
32275
- deepClone
32276
- ], TextureSheetAnimationModule.prototype, "startFrame", void 0);
32277
32287
  __decorate([
32278
32288
  deepClone
32279
32289
  ], TextureSheetAnimationModule.prototype, "frameOverTime", void 0);
@@ -32288,7 +32298,7 @@ __decorate([
32288
32298
  ], TextureSheetAnimationModule.prototype, "_tiling", void 0);
32289
32299
  __decorate([
32290
32300
  ignoreClone
32291
- ], TextureSheetAnimationModule.prototype, "_textureSheetMacro", void 0);
32301
+ ], TextureSheetAnimationModule.prototype, "_frameCurveMacro", void 0);
32292
32302
  var TextureSheetAnimationType;
32293
32303
  (function(TextureSheetAnimationType) {
32294
32304
  TextureSheetAnimationType[TextureSheetAnimationType["WholeSheet"] = 0] = "WholeSheet";
@@ -33022,12 +33032,18 @@ __decorate([
33022
33032
  instanceVertices[offset + 33] = rot.w;
33023
33033
  }
33024
33034
  // Simulation UV
33025
- if (this.textureSheetAnimation.enabled) {
33026
- var tillingInfo = this.textureSheetAnimation._tillingInfo;
33027
- instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = tillingInfo.x;
33028
- instanceVertices[offset + 35] = tillingInfo.y;
33029
- instanceVertices[offset + 36] = 0;
33030
- instanceVertices[offset + 37] = 0;
33035
+ if (textureSheetAnimation.enabled) {
33036
+ var frameOverTime = textureSheetAnimation.frameOverTime;
33037
+ var _textureSheetAnimation__tillingInfo = textureSheetAnimation._tillingInfo, x = _textureSheetAnimation__tillingInfo.x, y = _textureSheetAnimation__tillingInfo.y, z = _textureSheetAnimation__tillingInfo.z;
33038
+ var tileRow = 0;
33039
+ if (frameOverTime.mode === exports.ParticleCurveMode.Constant || frameOverTime.mode === exports.ParticleCurveMode.TwoConstants) {
33040
+ tileRow = Math.floor(frameOverTime.evaluate(undefined, textureSheetAnimation._frameOverTimeRand.random()) * z) * x;
33041
+ }
33042
+ var tileRowIndex = Math.floor(tileRow);
33043
+ instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = x;
33044
+ instanceVertices[offset + 35] = y;
33045
+ instanceVertices[offset + 36] = tileRow - tileRowIndex;
33046
+ instanceVertices[offset + 37] = tileRowIndex * y;
33031
33047
  } else {
33032
33048
  instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = 1;
33033
33049
  instanceVertices[offset + 35] = 1;
package/dist/module.js CHANGED
@@ -2248,7 +2248,7 @@ var size_over_lifetime_module = "#define GLSLIFY 1\n#ifdef RENDERER_SOL_CURVE_MO
2248
2248
 
2249
2249
  var color_over_lifetime_module = "#define GLSLIFY 1\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nuniform vec4 renderer_COLMaxGradientColor[4];uniform vec2 renderer_COLMaxGradientAlpha[4];\n#ifdef RENDERER_COL_RANDOM_GRADIENTS\nuniform vec4 renderer_COLMinGradientColor[4];uniform vec2 renderer_COLMinGradientAlpha[4];\n#endif\nuniform vec4 renderer_COLGradientKeysMaxTime;\n#endif\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nvec4 evaluateParticleGradient(in vec4 colorKeys[4],in float colorKeysMaxTime,in vec2 alphaKeys[4],in float alphaKeysMaxTime,in float normalizedAge){vec4 value;float alphaAge=min(normalizedAge,alphaKeysMaxTime);for(int i=0;i<4;i++){vec2 key=alphaKeys[i];float time=key.x;if(alphaAge<=time){if(i==0){value.a=alphaKeys[0].y;}else{vec2 lastKey=alphaKeys[i-1];float lastTime=lastKey.x;float age=(alphaAge-lastTime)/(time-lastTime);value.a=mix(lastKey.y,key.y,age);}break;}}float colorAge=min(normalizedAge,colorKeysMaxTime);for(int i=0;i<4;i++){vec4 key=colorKeys[i];float time=key.x;if(colorAge<=time){if(i==0){value.rgb=colorKeys[0].yzw;}else{vec4 lastKey=colorKeys[i-1];float lastTime=lastKey.x;float age=(colorAge-lastTime)/(time-lastTime);value.rgb=mix(lastKey.yzw,key.yzw,age);}break;}}return value;}\n#endif\nvec4 computeParticleColor(in vec4 color,in float normalizedAge){\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\nvec4 gradientColor=evaluateParticleGradient(renderer_COLMaxGradientColor,renderer_COLGradientKeysMaxTime.z,renderer_COLMaxGradientAlpha,renderer_COLGradientKeysMaxTime.w,normalizedAge);\n#endif\n#ifdef RENDERER_COL_RANDOM_GRADIENTS\ngradientColor=mix(evaluateParticleGradient(renderer_COLMinGradientColor,renderer_COLGradientKeysMaxTime.x,renderer_COLMinGradientAlpha,renderer_COLGradientKeysMaxTime.y,normalizedAge),gradientColor,a_Random0.y);\n#endif\n#if defined(RENDERER_COL_GRADIENT) || defined(RENDERER_COL_RANDOM_GRADIENTS)\ncolor*=gradientColor;\n#endif\nreturn color;}"; // eslint-disable-line
2250
2250
 
2251
- var texture_sheet_animation_module = "#define GLSLIFY 1\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nuniform float renderer_TSACycles;uniform vec3 renderer_TSATillingParams;uniform vec2 renderer_TSAFrameMaxCurve[4];\n#endif\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nuniform vec2 renderer_TSAFrameMinCurve[4];\n#endif\nvec2 computeParticleUV(in vec2 uv,in float normalizedAge){\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nfloat scaledNormalizedAge=normalizedAge*renderer_TSACycles;float cycleNormalizedAge=scaledNormalizedAge-floor(scaledNormalizedAge);float normalizedFrame=evaluateParticleCurve(renderer_TSAFrameMaxCurve,cycleNormalizedAge);\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nnormalizedFrame=mix(evaluateParticleCurve(renderer_TSAFrameMinCurve,cycleNormalizedAge),normalizedFrame,a_Random1.x);\n#endif\nfloat frame=floor(normalizedFrame*renderer_TSATillingParams.z);float totalULength=frame*renderer_TSATillingParams.x;float floorTotalULength=floor(totalULength);uv.x+=totalULength-floorTotalULength;uv.y+=floorTotalULength*renderer_TSATillingParams.y;\n#endif\nreturn uv;}"; // eslint-disable-line
2251
+ var texture_sheet_animation_module = "#define GLSLIFY 1\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nuniform float renderer_TSACycles;uniform vec3 renderer_TSATillingParams;uniform vec2 renderer_TSAFrameMaxCurve[4];\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nuniform vec2 renderer_TSAFrameMinCurve[4];\n#endif\n#endif\nvec2 computeParticleUV(in vec2 uv,in float normalizedAge){\n#if defined(RENDERER_TSA_FRAME_CURVE) || defined(RENDERER_TSA_FRAME_RANDOM_CURVES)\nfloat scaledNormalizedAge=normalizedAge*renderer_TSACycles;float cycleNormalizedAge=scaledNormalizedAge-floor(scaledNormalizedAge);float normalizedFrame=evaluateParticleCurve(renderer_TSAFrameMaxCurve,cycleNormalizedAge);\n#ifdef RENDERER_TSA_FRAME_RANDOM_CURVES\nnormalizedFrame=mix(evaluateParticleCurve(renderer_TSAFrameMinCurve,cycleNormalizedAge),normalizedFrame,a_Random1.x);\n#endif\nfloat frame=floor(normalizedFrame*renderer_TSATillingParams.z);float tileRow=frame*renderer_TSATillingParams.x;float floorTotalULength=floor(tileRow);uv.x+=tileRow-tileRowIndex;uv.y+=tileRowIndex*renderer_TSATillingParams.y;\n#endif\nreturn uv;}"; // eslint-disable-line
2252
2252
 
2253
2253
  var sphere_billboard = "#define GLSLIFY 1\n#ifdef RENDERER_MODE_SPHERE_BILLBOARD\nvec2 corner=a_CornerTextureCoordinate.xy+renderer_PivotOffset.xy;vec3 sideVector=normalize(cross(camera_Forward,camera_Up));vec3 upVector=normalize(cross(sideVector,camera_Forward));corner*=computeParticleSizeBillboard(a_StartSize.xy,normalizedAge);\n#if defined(RENDERER_ROL_CONSTANT_MODE) || defined(RENDERER_ROL_CURVE_MODE)\nif(renderer_ThreeDStartRotation){vec3 rotation=vec3(a_StartRotation0.xy,computeParticleRotationFloat(a_StartRotation0.z,age,normalizedAge));center+=renderer_SizeScale.xzy*rotationByEuler(corner.x*sideVector+corner.y*upVector,rotation);}else{float rot=computeParticleRotationFloat(a_StartRotation0.x,age,normalizedAge);float c=cos(rot);float s=sin(rot);mat2 rotation=mat2(c,-s,s,c);corner=rotation*corner;center+=renderer_SizeScale.xzy*(corner.x*sideVector+corner.y*upVector);}\n#else\nif(renderer_ThreeDStartRotation){center+=renderer_SizeScale.xzy*rotationByEuler(corner.x*sideVector+corner.y*upVector,a_StartRotation0);}else{float c=cos(a_StartRotation0.x);float s=sin(a_StartRotation0.x);mat2 rotation=mat2(c,-s,s,c);corner=rotation*corner;center+=renderer_SizeScale.xzy*(corner.x*sideVector+corner.y*upVector);}\n#endif\n#endif\n"; // eslint-disable-line
2254
2254
 
@@ -10755,6 +10755,9 @@ var SubRenderElement = /*#__PURE__*/ function() {
10755
10755
  __decorate([
10756
10756
  assignmentClone
10757
10757
  ], SpriteMask.prototype, "influenceLayers", void 0);
10758
+ __decorate([
10759
+ ignoreClone
10760
+ ], SpriteMask.prototype, "_renderElement", void 0);
10758
10761
  __decorate([
10759
10762
  ignoreClone
10760
10763
  ], SpriteMask.prototype, "_subChunk", void 0);
@@ -20925,6 +20928,8 @@ var Collision = function Collision() {
20925
20928
  _this._setUpDirection = _this._setUpDirection.bind(_assert_this_initialized(_this));
20926
20929
  //@ts-ignore
20927
20930
  _this._upDirection._onValueChanged = _this._setUpDirection;
20931
+ // sync world position to physical space
20932
+ _this._onUpdate();
20928
20933
  return _this;
20929
20934
  }
20930
20935
  var _proto = CharacterController.prototype;
@@ -20935,7 +20940,9 @@ var Collision = function Collision() {
20935
20940
  * @param elapsedTime - Time elapsed since last call
20936
20941
  * @return flags - The ControllerCollisionFlag
20937
20942
  */ _proto.move = function move(disp, minDist, elapsedTime) {
20938
- return this._nativeCollider.move(disp, minDist, elapsedTime);
20943
+ var flags = this._nativeCollider.move(disp, minDist, elapsedTime);
20944
+ this._syncWorldPositionFromPhysicalSpace();
20945
+ return flags;
20939
20946
  };
20940
20947
  /**
20941
20948
  * Add collider shape on this controller.
@@ -20971,8 +20978,7 @@ var Collision = function Collision() {
20971
20978
  /**
20972
20979
  * @internal
20973
20980
  */ _proto._onLateUpdate = function _onLateUpdate() {
20974
- var position = this.entity.transform.worldPosition;
20975
- this._nativeCollider.getWorldPosition(position);
20981
+ this._syncWorldPositionFromPhysicalSpace();
20976
20982
  this._updateFlag.flag = false;
20977
20983
  };
20978
20984
  /**
@@ -20995,6 +21001,9 @@ var Collision = function Collision() {
20995
21001
  physics._removeColliderShape(shapes[i]);
20996
21002
  }
20997
21003
  };
21004
+ _proto._syncWorldPositionFromPhysicalSpace = function _syncWorldPositionFromPhysicalSpace() {
21005
+ this._nativeCollider.getWorldPosition(this.entity.transform.worldPosition);
21006
+ };
20998
21007
  _proto._setUpDirection = function _setUpDirection() {
20999
21008
  this._nativeCollider.setUpDirection(this._upDirection);
21000
21009
  };
@@ -28679,7 +28688,9 @@ var AnimatorLayerBlendingMode;
28679
28688
  // Precalculate to get the transition
28680
28689
  srcPlayData.update(playDeltaTime);
28681
28690
  var clipTime = srcPlayData.clipTime, isForwards = srcPlayData.isForwards;
28682
- var transition = this._applyTransitionsByCondition(layerIndex, layerData, layer, state, layer.stateMachine.anyStateTransitions, aniUpdate) || this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, state.transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
28691
+ var transitions = state.transitions;
28692
+ var anyStateTransitions = layer.stateMachine.anyStateTransitions;
28693
+ var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, srcPlayData, transitions, lastClipTime, clipTime, playDeltaTime, aniUpdate);
28683
28694
  var playCostTime;
28684
28695
  if (transition) {
28685
28696
  var clipDuration = state.clip.length;
@@ -28763,7 +28774,7 @@ var AnimatorLayerBlendingMode;
28763
28774
  playedTime - dstPlayDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28764
28775
  playedTime - transitionDuration : dstPlayDeltaTime;
28765
28776
  }
28766
- var actualCostTime = dstPlaySpeed === 0 ? 0 : dstPlayCostTime / dstPlaySpeed;
28777
+ var actualCostTime = dstPlaySpeed === 0 ? deltaTime : dstPlayCostTime / dstPlaySpeed;
28767
28778
  var srcPlayCostTime = actualCostTime * srcPlaySpeed;
28768
28779
  srcPlayData.update(srcPlayCostTime);
28769
28780
  destPlayData.update(dstPlayCostTime);
@@ -28771,6 +28782,7 @@ var AnimatorLayerBlendingMode;
28771
28782
  (crossWeight >= 1.0 - MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
28772
28783
  var crossFadeFinished = crossWeight === 1.0;
28773
28784
  if (crossFadeFinished) {
28785
+ srcPlayData.playState = AnimatorStatePlayState.Finished;
28774
28786
  this._preparePlayOwner(layerData, destState);
28775
28787
  this._evaluatePlayingState(destPlayData, weight, additive, aniUpdate);
28776
28788
  } else {
@@ -28825,7 +28837,7 @@ var AnimatorLayerBlendingMode;
28825
28837
  playedTime - playDeltaTime > transitionDuration ? // -(transitionDuration - playedTime)
28826
28838
  playedTime - transitionDuration : playDeltaTime;
28827
28839
  }
28828
- var actualCostTime = playSpeed === 0 ? 0 : dstPlayCostTime / playSpeed;
28840
+ var actualCostTime = playSpeed === 0 ? deltaTime : dstPlayCostTime / playSpeed;
28829
28841
  destPlayData.update(dstPlayCostTime);
28830
28842
  var crossWeight = Math.abs(destPlayData.frameTime) / transitionDuration;
28831
28843
  (crossWeight >= 1.0 - MathUtil.zeroTolerance || transitionDuration === 0) && (crossWeight = 1.0);
@@ -28865,14 +28877,16 @@ var AnimatorLayerBlendingMode;
28865
28877
  }
28866
28878
  };
28867
28879
  _proto._updateFinishedState = function _updateFinishedState(layerIndex, layerData, layer, weight, additive, deltaTime, aniUpdate) {
28868
- var stateMachine = layer.stateMachine;
28880
+ layer.stateMachine;
28869
28881
  var playData = layerData.srcPlayData;
28870
28882
  var state = playData.state;
28871
28883
  var actualSpeed = state.speed * this.speed;
28872
28884
  var actualDeltaTime = actualSpeed * deltaTime;
28873
28885
  playData.updateOrientation(actualDeltaTime);
28874
28886
  var clipTime = playData.clipTime, isForwards = playData.isForwards;
28875
- var transition = this._applyTransitionsByCondition(layerIndex, layerData, layer, state, stateMachine.anyStateTransitions, aniUpdate) || this._applyStateTransitions(layerIndex, layerData, layer, isForwards, playData, state.transitions, clipTime, clipTime, actualDeltaTime, aniUpdate);
28887
+ var transitions = state.transitions;
28888
+ var anyStateTransitions = layer.stateMachine.anyStateTransitions;
28889
+ var transition = anyStateTransitions.length && this._applyTransitionsByCondition(layerIndex, layerData, layer, state, anyStateTransitions, aniUpdate) || transitions.length && this._applyStateTransitions(layerIndex, layerData, layer, isForwards, playData, transitions, clipTime, clipTime, actualDeltaTime, aniUpdate);
28876
28890
  if (transition) {
28877
28891
  this._updateState(layerIndex, layerData, layer, deltaTime, aniUpdate);
28878
28892
  } else {
@@ -32195,7 +32209,6 @@ __decorate([
32195
32209
  function TextureSheetAnimationModule() {
32196
32210
  var _this;
32197
32211
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
32198
- /** Start frame of the texture sheet. */ _this.startFrame = new ParticleCompositeCurve(0);
32199
32212
  /** Frame over time curve of the texture sheet. */ _this.frameOverTime = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
32200
32213
  /** Texture sheet animation type. */ _this.type = /** Animate over the whole texture sheet from left to right, top to bottom. */ 0;
32201
32214
  /** Cycle count. */ _this.cycleCount = 1;
@@ -32225,7 +32238,7 @@ __decorate([
32225
32238
  shaderData.setVector3(TextureSheetAnimationModule._tillingParamsProperty, this._tillingInfo);
32226
32239
  }
32227
32240
  }
32228
- this._textureSheetMacro = this._enableMacro(shaderData, this._textureSheetMacro, frameMacro);
32241
+ this._frameCurveMacro = this._enableMacro(shaderData, this._frameCurveMacro, frameMacro);
32229
32242
  };
32230
32243
  /**
32231
32244
  * @internal
@@ -32255,20 +32268,17 @@ __decorate([
32255
32268
  TextureSheetAnimationModule._frameRandomCurvesMacro = ShaderMacro.getByName("RENDERER_TSA_FRAME_RANDOM_CURVES");
32256
32269
  })();
32257
32270
  (function() {
32258
- TextureSheetAnimationModule._cycleCountProperty = ShaderProperty.getByName("renderer_TSACycles");
32271
+ TextureSheetAnimationModule._frameMinCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMinCurve");
32259
32272
  })();
32260
32273
  (function() {
32261
- TextureSheetAnimationModule._tillingParamsProperty = ShaderProperty.getByName("renderer_TSATillingParams");
32274
+ TextureSheetAnimationModule._frameMaxCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMaxCurve");
32262
32275
  })();
32263
32276
  (function() {
32264
- TextureSheetAnimationModule._frameMinCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMinCurve");
32277
+ TextureSheetAnimationModule._cycleCountProperty = ShaderProperty.getByName("renderer_TSACycles");
32265
32278
  })();
32266
32279
  (function() {
32267
- TextureSheetAnimationModule._frameMaxCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMaxCurve");
32280
+ TextureSheetAnimationModule._tillingParamsProperty = ShaderProperty.getByName("renderer_TSATillingParams");
32268
32281
  })();
32269
- __decorate([
32270
- deepClone
32271
- ], TextureSheetAnimationModule.prototype, "startFrame", void 0);
32272
32282
  __decorate([
32273
32283
  deepClone
32274
32284
  ], TextureSheetAnimationModule.prototype, "frameOverTime", void 0);
@@ -32283,7 +32293,7 @@ __decorate([
32283
32293
  ], TextureSheetAnimationModule.prototype, "_tiling", void 0);
32284
32294
  __decorate([
32285
32295
  ignoreClone
32286
- ], TextureSheetAnimationModule.prototype, "_textureSheetMacro", void 0);
32296
+ ], TextureSheetAnimationModule.prototype, "_frameCurveMacro", void 0);
32287
32297
  var TextureSheetAnimationType;
32288
32298
  (function(TextureSheetAnimationType) {
32289
32299
  TextureSheetAnimationType[TextureSheetAnimationType["WholeSheet"] = 0] = "WholeSheet";
@@ -33017,12 +33027,18 @@ __decorate([
33017
33027
  instanceVertices[offset + 33] = rot.w;
33018
33028
  }
33019
33029
  // Simulation UV
33020
- if (this.textureSheetAnimation.enabled) {
33021
- var tillingInfo = this.textureSheetAnimation._tillingInfo;
33022
- instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = tillingInfo.x;
33023
- instanceVertices[offset + 35] = tillingInfo.y;
33024
- instanceVertices[offset + 36] = 0;
33025
- instanceVertices[offset + 37] = 0;
33030
+ if (textureSheetAnimation.enabled) {
33031
+ var frameOverTime = textureSheetAnimation.frameOverTime;
33032
+ var _textureSheetAnimation__tillingInfo = textureSheetAnimation._tillingInfo, x = _textureSheetAnimation__tillingInfo.x, y = _textureSheetAnimation__tillingInfo.y, z = _textureSheetAnimation__tillingInfo.z;
33033
+ var tileRow = 0;
33034
+ if (frameOverTime.mode === ParticleCurveMode.Constant || frameOverTime.mode === ParticleCurveMode.TwoConstants) {
33035
+ tileRow = Math.floor(frameOverTime.evaluate(undefined, textureSheetAnimation._frameOverTimeRand.random()) * z) * x;
33036
+ }
33037
+ var tileRowIndex = Math.floor(tileRow);
33038
+ instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = x;
33039
+ instanceVertices[offset + 35] = y;
33040
+ instanceVertices[offset + 36] = tileRow - tileRowIndex;
33041
+ instanceVertices[offset + 37] = tileRowIndex * y;
33026
33042
  } else {
33027
33043
  instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = 1;
33028
33044
  instanceVertices[offset + 35] = 1;