fuckingtech/public/assets/glsl/lygia/sdf/heartSDF.msl
Elias Rhouzlane bf76c6b086 fix: code
2025-04-06 17:23:52 +02:00

25 lines
No EOL
770 B
Text

/*
contributors: Patricio Gonzalez Vivo
description: Returns a heart shaped SDF
use: heartSDF(<float2> st)
examples:
- https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/draw_shapes.frag
license:
- Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0
- Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license
*/
#ifndef FNC_HEARTSDF
#define FNC_HEARTSDF
float heartSDF(float2 st) {
#ifdef CENTER_2D
st -= CENTER_2D;
#else
st -= 0.5;
#endif
st -= float2(0.0, 0.3);
float r = length(st) * 5.0;
st = normalize(st);
return r - ((st.y * pow(abs(st.x), 0.67)) / (st.y + 1.5) - (2.0) * st.y + 1.26);
}
#endif