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

24 lines
476 B
GLSL

#include "nyquist.glsl"
/*
contributors: Shadi El Hajj
description: An anti-aliased triangle wave function.
use: <float> mirror(<float> x)
license: MIT License (MIT) Copyright (c) 2024 Shadi EL Hajj
*/
#ifndef FNC_AAMIRROR
#define FNC_AAMIRROR
float aamirror(float x) {
#if defined(AA_EDGE)
float afwidth = AA_EDGE;
#else
float afwidth = length(vec2(dFdx(x),dFdy(x)));
#endif
float v = abs(x - floor(x + 0.5)) * 2.0;
return nyquist(v, afwidth);
}
#endif