lygia
/v1.1.6
/sdf
/opElongate
)elongate operation of two SDFs
Use:
<vec4> opElongate( in <vec3> p, in <vec3> h )
#ifndef FNC_OPELONGATE
#define FNC_OPELONGATE
vec2 opElongate( in vec2 p, in vec2 h ) {
return p-clamp(p,-h,h);
}
vec3 opElongate( in vec3 p, in vec3 h ) {
return p-clamp(p,-h,h);
}
vec4 opElongate( in vec4 p, in vec4 h ) {
vec3 q = abs(p)-h;
return vec4( max(q,0.0), min(max(q.x,max(q.y,q.z)), 0.0) );
}
#endif
Use:
<float4> opElongate( in <float3> p, in <float3> h )
#ifndef FNC_OPELONGATE
#define FNC_OPELONGATE
float2 opElongate( in float2 p, in float2 h ) {
return p-clamp(p,-h,h);
}
float3 opElongate( in float3 p, in float3 h ) {
return p-clamp(p,-h,h);
}
float4 opElongate( in float4 p, in float4 h ) {
float3 q = abs(p)-h;
return float4( max(q,0.0), min(max(q.x,max(q.y,q.z)), 0.0) );
}
#endif
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository