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

35 lines
No EOL
876 B
GLSL

#include "../sdf/rectSDF.glsl"
#include "fill.glsl"
#include "stroke.glsl"
/*
contributors: Patricio Gonzalez Vivo
description: Draw a rectangel filled or not.
use: rect(<vec2> st, <vec2> size [, <float> width])
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_RECT
#define FNC_RECT
float rect(vec2 st, vec2 size, float strokeWidth) {
return stroke(rectSDF(st, size), 1.0, strokeWidth);
}
float rect(vec2 st, float size, float strokeWidth) {
return stroke(rectSDF(st, vec2(size)), 1.0, strokeWidth);
}
float rect(vec2 st, vec2 size) {
return fill(rectSDF(st, size), 1.0);
}
float rect(vec2 st, float size) {
return fill(rectSDF(st, vec2(size)), 1.0);
}
#endif