HeavenStudioPlus/Assets/DoodleShader/GPU-Doodle/DoodleText.cs
2024-06-12 10:38:28 -04:00

31 lines
937 B
C#

using UnityEngine;
public class DoodleText : MonoBehaviour
{
public Material mat; // - Target material
public Vector4 DoodleMaxOffset; // - How far the UV can be distorted
public float DoodleFrameTime; // - How long does a frame last
public int DoodleFrameCount; // - How many frames per animation
public Vector4 DoodleNoiseScale; // - How noisy should the effect be
public bool DoodleOn; // - Toggle doodle effect
void Update()
{
SetAll();
}
public void SetAll()
{
mat.SetVector("_DoodleMaxOffset", DoodleMaxOffset);
mat.SetFloat("_DoodleFrameTime", DoodleFrameTime);
mat.SetInt("_DoodleFrameCount", DoodleFrameCount);
mat.SetVector("_DoodleNoiseScale", DoodleNoiseScale);
if (DoodleOn)
Shader.EnableKeyword("DOODLE_ON");
else
Shader.DisableKeyword("DOODLE_ON");
}
}