From 5086faaa0664a55db116ffe01ee1a1514e1870e6 Mon Sep 17 00:00:00 2001 From: nullstalgia Date: Tue, 7 May 2024 15:54:45 -0700 Subject: [PATCH] Allow choosing a specific frame when Zero FPS is supplied --- .../Shader/Includes/lil_common_functions.hlsl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Assets/lilToon/Shader/Includes/lil_common_functions.hlsl b/Assets/lilToon/Shader/Includes/lil_common_functions.hlsl index 22c48c47..ea2c1c28 100644 --- a/Assets/lilToon/Shader/Includes/lil_common_functions.hlsl +++ b/Assets/lilToon/Shader/Includes/lil_common_functions.hlsl @@ -514,9 +514,17 @@ float2 lilCalcDecalUV( float2 lilCalcAtlasAnimation(float2 uv, float4 decalAnimation, float4 decalSubParam) { float2 outuv = lerp(float2(uv.x, 1.0-uv.y), 0.5, decalSubParam.z); - uint animTime = (uint)(LIL_TIME * decalAnimation.w) % (uint)decalAnimation.z; - uint offsetX = animTime % (uint)decalAnimation.x; - uint offsetY = animTime / (uint)decalAnimation.x; + uint animFrame; + if (decalAnimation.w == 0.0) + { + animFrame = (uint)decalAnimation.z; + } + else + { + animFrame = (uint)(LIL_TIME * decalAnimation.w) % (uint)decalAnimation.z; + } + uint offsetX = animFrame % (uint)decalAnimation.x; + uint offsetY = animFrame / (uint)decalAnimation.x; outuv = (outuv + float2(offsetX,offsetY)) * decalSubParam.xy / decalAnimation.xy; outuv.y = 1.0-outuv.y; return outuv;