A game about forced loneliness, made by TACStudios
1#ifndef UNITY_SDF2D_INCLUDED 2#define UNITY_SDF2D_INCLUDED 3 4// Ref: https://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm 5 6float CircleSDF(float2 position, float radius) 7{ 8 return length(position) - radius; 9} 10 11float RectangleSDF(float2 position, float2 bound) 12{ 13 float2 d = abs(position) - bound; 14 return length(max(d, float2(0, 0))) + min(max(d.x, d.y), 0.0); 15} 16 17float EllipseSDF(float2 position, float2 r) 18{ 19 float2 p = position; 20 float2 r2 = r*r; 21 22 float k0 = length(p/r); 23 float k1 = length(p/r2); 24 25 return k0*(k0 - 1.0)/k1; 26} 27 28#endif // UNITY_SDF2D_INCLUDED