Merged in patch/uiparticlesystem-texture (pull request #104)

Patch supplied by contributor to improve the texture sheet use with the UIParticlesystem
pull/413/head
Simon Jackson 2020-10-25 18:06:28 +00:00
commit 0ab5e6edf7
1 changed files with 5 additions and 4 deletions

View File

@ -223,9 +223,10 @@ namespace UnityEngine.UI.Extensions
frame = Mathf.FloorToInt(frameProgress * textureSheetAnimation.numTilesX);
int row = textureSheetAnimation.rowIndex;
// if (textureSheetAnimation.useRandomRow) { // FIXME - is this handled internally by rowIndex?
// row = Random.Range(0, textureSheetAnimation.numTilesY, using: particle.randomSeed);
// }
if (textureSheetAnimation.rowMode == ParticleSystemAnimationRowMode.Random)
{ // FIXME - is this handled internally by rowIndex?
row = Mathf.Abs((int)particle.randomSeed % textureSheetAnimation.numTilesY);
}
frame += row * textureSheetAnimation.numTilesX;
break;
@ -234,7 +235,7 @@ namespace UnityEngine.UI.Extensions
frame %= textureSheetAnimationFrames;
particleUV.x = (frame % textureSheetAnimation.numTilesX) * textureSheetAnimationFrameSize.x;
particleUV.y = 1.0f - Mathf.FloorToInt(frame / textureSheetAnimation.numTilesX) * textureSheetAnimationFrameSize.y;
particleUV.y = 1.0f - ((frame / textureSheetAnimation.numTilesX) + 1) * textureSheetAnimationFrameSize.y;
particleUV.z = particleUV.x + textureSheetAnimationFrameSize.x;
particleUV.w = particleUV.y + textureSheetAnimationFrameSize.y;
}