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