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

17 lines
No EOL
410 B
HLSL

/*
contributors: Inigo Quiles
description: generate the SDF of a hexagonal prism
use: <float> hexPrismSDF( in <float3> pos, in <float2> h )
*/
#ifndef FNC_HEXPRISMSDF
#define FNC_HEXPRISMSDF
float hexPrismSDF( float3 p, float2 h ) {
float3 q = abs(p);
float d1 = q.z-h.y;
float d2 = max((q.x*0.866025+q.y*0.5),q.y)-h.x;
return length(max(float2(d1,d2),0.0)) + min(max(d1,d2), 0.);
}
#endif