This repository has been archived on 2023-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
2021-06-09 16:43:27 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Matrix_App.PregeneratedMods
|
|
|
|
|
{
|
|
|
|
|
public class RandomPixels : MatrixGifGenerator
|
|
|
|
|
{
|
2021-06-09 19:19:30 +00:00
|
|
|
|
[UiDescriptionAttribute(title: "Seed", description: "Just a seed for a bad deterministic random function")]
|
2021-06-09 16:43:27 +00:00
|
|
|
|
public int seed = 0;
|
|
|
|
|
|
|
|
|
|
protected override void ColorFragment(in int x, in int y, in float u, in float v, in int frame, out float r, out float g, out float b)
|
|
|
|
|
{
|
|
|
|
|
r = next(frame, x, y);
|
|
|
|
|
g = next(frame, x, y + 67);
|
|
|
|
|
b = next(frame, x, y + 34968);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private float next(int frame, int x, int y)
|
|
|
|
|
{
|
|
|
|
|
float k = MathF.Sin(frame * 2356f + (x + y) * 5334f + (y * x) * 534f + 78.0f + seed * 435f) * 567f;
|
|
|
|
|
return k - MathF.Floor(k);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|