@galacean/engine-core 1.3.6 → 1.3.8

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
 
@@ -18840,39 +18840,43 @@ var ObjectPool = /*#__PURE__*/ function() {
18840
18840
  return null;
18841
18841
  };
18842
18842
  _proto._freeArea = function _freeArea(area) {
18843
- var areas = this.vertexFreeAreas;
18844
- var areaLen = areas.length;
18845
- if (areaLen === 0) {
18846
- areas.push(area);
18847
- return;
18848
- }
18843
+ var start = area.start, size = area.size;
18844
+ var freeAreas = this.vertexFreeAreas;
18845
+ var end = start + size;
18849
18846
  var pool = PrimitiveChunk.areaPool;
18850
- var preArea = area;
18851
- var notMerge = true;
18852
- for(var i = 0; i < areaLen; ++i){
18853
- var curArea = areas[i];
18854
- var preStart = preArea.start, size = preArea.size;
18855
- var curStart = curArea.start;
18856
- var preEnd = preStart + size;
18857
- var curEnd = curStart + curArea.size;
18858
- if (preEnd < curStart) {
18859
- notMerge && areas.splice(i, 0, preArea);
18847
+ for(var i = 0, areaLen = freeAreas.length; i < areaLen; ++i){
18848
+ var curFreeArea = freeAreas[i];
18849
+ var curStart = curFreeArea.start;
18850
+ var curEnd = curStart + curFreeArea.size;
18851
+ if (end < curStart) {
18852
+ // The area to be freed is to the left of the current free area and is not connected
18853
+ freeAreas.splice(i, 0, area);
18854
+ return;
18855
+ } else if (end === curStart) {
18856
+ // The area to be freed is to the left of the current free area and is connected
18857
+ curFreeArea.start = start;
18858
+ curFreeArea.size += size;
18859
+ pool.return(area);
18860
+ return;
18861
+ } else if (start === curEnd) {
18862
+ // The area to be freed is to the right of the current free area and is connected
18863
+ curFreeArea.size += size;
18864
+ pool.return(area);
18865
+ var nextIndex = i + 1;
18866
+ if (nextIndex < areaLen) {
18867
+ var nextFreeArea = freeAreas[nextIndex];
18868
+ if (end === nextFreeArea.start) {
18869
+ // The cur free area after merge is to the left of the next free area and is connected
18870
+ curFreeArea.size += nextFreeArea.size;
18871
+ freeAreas.splice(nextIndex, 1);
18872
+ pool.return(nextFreeArea);
18873
+ }
18874
+ }
18860
18875
  return;
18861
- } else if (preEnd === curStart) {
18862
- curArea.start = preStart;
18863
- curArea.size += size;
18864
- pool.return(preArea);
18865
- preArea = curArea;
18866
- notMerge = false;
18867
- } else if (preStart === curEnd) {
18868
- curArea.size += size;
18869
- pool.return(preArea);
18870
- preArea = curArea;
18871
- notMerge = false;
18872
- } else if (preStart > curEnd) {
18873
- i + 1 === areaLen && areas.push(preArea);
18874
18876
  }
18875
18877
  }
18878
+ // The area to be freed is to the right of the last free area and is not connected or free areas is empty
18879
+ freeAreas.push(area);
18876
18880
  };
18877
18881
  return PrimitiveChunk;
18878
18882
  }();
@@ -32214,7 +32218,6 @@ __decorate([
32214
32218
  function TextureSheetAnimationModule() {
32215
32219
  var _this;
32216
32220
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
32217
- /** Start frame of the texture sheet. */ _this.startFrame = new ParticleCompositeCurve(0);
32218
32221
  /** Frame over time curve of the texture sheet. */ _this.frameOverTime = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
32219
32222
  /** Texture sheet animation type. */ _this.type = /** Animate over the whole texture sheet from left to right, top to bottom. */ 0;
32220
32223
  /** Cycle count. */ _this.cycleCount = 1;
@@ -32244,7 +32247,7 @@ __decorate([
32244
32247
  shaderData.setVector3(TextureSheetAnimationModule._tillingParamsProperty, this._tillingInfo);
32245
32248
  }
32246
32249
  }
32247
- this._textureSheetMacro = this._enableMacro(shaderData, this._textureSheetMacro, frameMacro);
32250
+ this._frameCurveMacro = this._enableMacro(shaderData, this._frameCurveMacro, frameMacro);
32248
32251
  };
32249
32252
  /**
32250
32253
  * @internal
@@ -32274,20 +32277,17 @@ __decorate([
32274
32277
  TextureSheetAnimationModule._frameRandomCurvesMacro = ShaderMacro.getByName("RENDERER_TSA_FRAME_RANDOM_CURVES");
32275
32278
  })();
32276
32279
  (function() {
32277
- TextureSheetAnimationModule._cycleCountProperty = ShaderProperty.getByName("renderer_TSACycles");
32280
+ TextureSheetAnimationModule._frameMinCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMinCurve");
32278
32281
  })();
32279
32282
  (function() {
32280
- TextureSheetAnimationModule._tillingParamsProperty = ShaderProperty.getByName("renderer_TSATillingParams");
32283
+ TextureSheetAnimationModule._frameMaxCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMaxCurve");
32281
32284
  })();
32282
32285
  (function() {
32283
- TextureSheetAnimationModule._frameMinCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMinCurve");
32286
+ TextureSheetAnimationModule._cycleCountProperty = ShaderProperty.getByName("renderer_TSACycles");
32284
32287
  })();
32285
32288
  (function() {
32286
- TextureSheetAnimationModule._frameMaxCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMaxCurve");
32289
+ TextureSheetAnimationModule._tillingParamsProperty = ShaderProperty.getByName("renderer_TSATillingParams");
32287
32290
  })();
32288
- __decorate([
32289
- deepClone
32290
- ], TextureSheetAnimationModule.prototype, "startFrame", void 0);
32291
32291
  __decorate([
32292
32292
  deepClone
32293
32293
  ], TextureSheetAnimationModule.prototype, "frameOverTime", void 0);
@@ -32302,7 +32302,7 @@ __decorate([
32302
32302
  ], TextureSheetAnimationModule.prototype, "_tiling", void 0);
32303
32303
  __decorate([
32304
32304
  ignoreClone
32305
- ], TextureSheetAnimationModule.prototype, "_textureSheetMacro", void 0);
32305
+ ], TextureSheetAnimationModule.prototype, "_frameCurveMacro", void 0);
32306
32306
  var TextureSheetAnimationType;
32307
32307
  (function(TextureSheetAnimationType) {
32308
32308
  TextureSheetAnimationType[TextureSheetAnimationType["WholeSheet"] = 0] = "WholeSheet";
@@ -33036,12 +33036,18 @@ __decorate([
33036
33036
  instanceVertices[offset + 33] = rot.w;
33037
33037
  }
33038
33038
  // Simulation UV
33039
- if (this.textureSheetAnimation.enabled) {
33040
- var tillingInfo = this.textureSheetAnimation._tillingInfo;
33041
- instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = tillingInfo.x;
33042
- instanceVertices[offset + 35] = tillingInfo.y;
33043
- instanceVertices[offset + 36] = 0;
33044
- instanceVertices[offset + 37] = 0;
33039
+ if (textureSheetAnimation.enabled) {
33040
+ var frameOverTime = textureSheetAnimation.frameOverTime;
33041
+ var _textureSheetAnimation__tillingInfo = textureSheetAnimation._tillingInfo, x = _textureSheetAnimation__tillingInfo.x, y = _textureSheetAnimation__tillingInfo.y, z = _textureSheetAnimation__tillingInfo.z;
33042
+ var tileRow = 0;
33043
+ if (frameOverTime.mode === exports.ParticleCurveMode.Constant || frameOverTime.mode === exports.ParticleCurveMode.TwoConstants) {
33044
+ tileRow = Math.floor(frameOverTime.evaluate(undefined, textureSheetAnimation._frameOverTimeRand.random()) * z) * x;
33045
+ }
33046
+ var tileRowIndex = Math.floor(tileRow);
33047
+ instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = x;
33048
+ instanceVertices[offset + 35] = y;
33049
+ instanceVertices[offset + 36] = tileRow - tileRowIndex;
33050
+ instanceVertices[offset + 37] = tileRowIndex * y;
33045
33051
  } else {
33046
33052
  instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = 1;
33047
33053
  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
 
@@ -18835,39 +18835,43 @@ var ObjectPool = /*#__PURE__*/ function() {
18835
18835
  return null;
18836
18836
  };
18837
18837
  _proto._freeArea = function _freeArea(area) {
18838
- var areas = this.vertexFreeAreas;
18839
- var areaLen = areas.length;
18840
- if (areaLen === 0) {
18841
- areas.push(area);
18842
- return;
18843
- }
18838
+ var start = area.start, size = area.size;
18839
+ var freeAreas = this.vertexFreeAreas;
18840
+ var end = start + size;
18844
18841
  var pool = PrimitiveChunk.areaPool;
18845
- var preArea = area;
18846
- var notMerge = true;
18847
- for(var i = 0; i < areaLen; ++i){
18848
- var curArea = areas[i];
18849
- var preStart = preArea.start, size = preArea.size;
18850
- var curStart = curArea.start;
18851
- var preEnd = preStart + size;
18852
- var curEnd = curStart + curArea.size;
18853
- if (preEnd < curStart) {
18854
- notMerge && areas.splice(i, 0, preArea);
18842
+ for(var i = 0, areaLen = freeAreas.length; i < areaLen; ++i){
18843
+ var curFreeArea = freeAreas[i];
18844
+ var curStart = curFreeArea.start;
18845
+ var curEnd = curStart + curFreeArea.size;
18846
+ if (end < curStart) {
18847
+ // The area to be freed is to the left of the current free area and is not connected
18848
+ freeAreas.splice(i, 0, area);
18849
+ return;
18850
+ } else if (end === curStart) {
18851
+ // The area to be freed is to the left of the current free area and is connected
18852
+ curFreeArea.start = start;
18853
+ curFreeArea.size += size;
18854
+ pool.return(area);
18855
+ return;
18856
+ } else if (start === curEnd) {
18857
+ // The area to be freed is to the right of the current free area and is connected
18858
+ curFreeArea.size += size;
18859
+ pool.return(area);
18860
+ var nextIndex = i + 1;
18861
+ if (nextIndex < areaLen) {
18862
+ var nextFreeArea = freeAreas[nextIndex];
18863
+ if (end === nextFreeArea.start) {
18864
+ // The cur free area after merge is to the left of the next free area and is connected
18865
+ curFreeArea.size += nextFreeArea.size;
18866
+ freeAreas.splice(nextIndex, 1);
18867
+ pool.return(nextFreeArea);
18868
+ }
18869
+ }
18855
18870
  return;
18856
- } else if (preEnd === curStart) {
18857
- curArea.start = preStart;
18858
- curArea.size += size;
18859
- pool.return(preArea);
18860
- preArea = curArea;
18861
- notMerge = false;
18862
- } else if (preStart === curEnd) {
18863
- curArea.size += size;
18864
- pool.return(preArea);
18865
- preArea = curArea;
18866
- notMerge = false;
18867
- } else if (preStart > curEnd) {
18868
- i + 1 === areaLen && areas.push(preArea);
18869
18871
  }
18870
18872
  }
18873
+ // The area to be freed is to the right of the last free area and is not connected or free areas is empty
18874
+ freeAreas.push(area);
18871
18875
  };
18872
18876
  return PrimitiveChunk;
18873
18877
  }();
@@ -32209,7 +32213,6 @@ __decorate([
32209
32213
  function TextureSheetAnimationModule() {
32210
32214
  var _this;
32211
32215
  _this = ParticleGeneratorModule1.apply(this, arguments) || this;
32212
- /** Start frame of the texture sheet. */ _this.startFrame = new ParticleCompositeCurve(0);
32213
32216
  /** Frame over time curve of the texture sheet. */ _this.frameOverTime = new ParticleCompositeCurve(new ParticleCurve(new CurveKey(0, 0), new CurveKey(1, 1)));
32214
32217
  /** Texture sheet animation type. */ _this.type = /** Animate over the whole texture sheet from left to right, top to bottom. */ 0;
32215
32218
  /** Cycle count. */ _this.cycleCount = 1;
@@ -32239,7 +32242,7 @@ __decorate([
32239
32242
  shaderData.setVector3(TextureSheetAnimationModule._tillingParamsProperty, this._tillingInfo);
32240
32243
  }
32241
32244
  }
32242
- this._textureSheetMacro = this._enableMacro(shaderData, this._textureSheetMacro, frameMacro);
32245
+ this._frameCurveMacro = this._enableMacro(shaderData, this._frameCurveMacro, frameMacro);
32243
32246
  };
32244
32247
  /**
32245
32248
  * @internal
@@ -32269,20 +32272,17 @@ __decorate([
32269
32272
  TextureSheetAnimationModule._frameRandomCurvesMacro = ShaderMacro.getByName("RENDERER_TSA_FRAME_RANDOM_CURVES");
32270
32273
  })();
32271
32274
  (function() {
32272
- TextureSheetAnimationModule._cycleCountProperty = ShaderProperty.getByName("renderer_TSACycles");
32275
+ TextureSheetAnimationModule._frameMinCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMinCurve");
32273
32276
  })();
32274
32277
  (function() {
32275
- TextureSheetAnimationModule._tillingParamsProperty = ShaderProperty.getByName("renderer_TSATillingParams");
32278
+ TextureSheetAnimationModule._frameMaxCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMaxCurve");
32276
32279
  })();
32277
32280
  (function() {
32278
- TextureSheetAnimationModule._frameMinCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMinCurve");
32281
+ TextureSheetAnimationModule._cycleCountProperty = ShaderProperty.getByName("renderer_TSACycles");
32279
32282
  })();
32280
32283
  (function() {
32281
- TextureSheetAnimationModule._frameMaxCurveProperty = ShaderProperty.getByName("renderer_TSAFrameMaxCurve");
32284
+ TextureSheetAnimationModule._tillingParamsProperty = ShaderProperty.getByName("renderer_TSATillingParams");
32282
32285
  })();
32283
- __decorate([
32284
- deepClone
32285
- ], TextureSheetAnimationModule.prototype, "startFrame", void 0);
32286
32286
  __decorate([
32287
32287
  deepClone
32288
32288
  ], TextureSheetAnimationModule.prototype, "frameOverTime", void 0);
@@ -32297,7 +32297,7 @@ __decorate([
32297
32297
  ], TextureSheetAnimationModule.prototype, "_tiling", void 0);
32298
32298
  __decorate([
32299
32299
  ignoreClone
32300
- ], TextureSheetAnimationModule.prototype, "_textureSheetMacro", void 0);
32300
+ ], TextureSheetAnimationModule.prototype, "_frameCurveMacro", void 0);
32301
32301
  var TextureSheetAnimationType;
32302
32302
  (function(TextureSheetAnimationType) {
32303
32303
  TextureSheetAnimationType[TextureSheetAnimationType["WholeSheet"] = 0] = "WholeSheet";
@@ -33031,12 +33031,18 @@ __decorate([
33031
33031
  instanceVertices[offset + 33] = rot.w;
33032
33032
  }
33033
33033
  // Simulation UV
33034
- if (this.textureSheetAnimation.enabled) {
33035
- var tillingInfo = this.textureSheetAnimation._tillingInfo;
33036
- instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = tillingInfo.x;
33037
- instanceVertices[offset + 35] = tillingInfo.y;
33038
- instanceVertices[offset + 36] = 0;
33039
- instanceVertices[offset + 37] = 0;
33034
+ if (textureSheetAnimation.enabled) {
33035
+ var frameOverTime = textureSheetAnimation.frameOverTime;
33036
+ var _textureSheetAnimation__tillingInfo = textureSheetAnimation._tillingInfo, x = _textureSheetAnimation__tillingInfo.x, y = _textureSheetAnimation__tillingInfo.y, z = _textureSheetAnimation__tillingInfo.z;
33037
+ var tileRow = 0;
33038
+ if (frameOverTime.mode === ParticleCurveMode.Constant || frameOverTime.mode === ParticleCurveMode.TwoConstants) {
33039
+ tileRow = Math.floor(frameOverTime.evaluate(undefined, textureSheetAnimation._frameOverTimeRand.random()) * z) * x;
33040
+ }
33041
+ var tileRowIndex = Math.floor(tileRow);
33042
+ instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = x;
33043
+ instanceVertices[offset + 35] = y;
33044
+ instanceVertices[offset + 36] = tileRow - tileRowIndex;
33045
+ instanceVertices[offset + 37] = tileRowIndex * y;
33040
33046
  } else {
33041
33047
  instanceVertices[offset + ParticleBufferUtils.simulationUVOffset] = 1;
33042
33048
  instanceVertices[offset + 35] = 1;