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

23 lines
737 B
Text

#include "rectSDF.msl"
/*
contributors: Patricio Gonzalez Vivo
description: Returns a cross-shaped SDF
use: crossSDF(<float2> st, size s)
options:
- CENTER_2D: float2, defaults to float2(.5)
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_CROSSSDF
#define FNC_CROSSSDF
float crossSDF(float2 st, float s) {
float2 size = float2(.25, s);
return min(rectSDF(st.xy, size.xy),
rectSDF(st.xy, size.yx));
}
#endif