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

16 lines
No EOL
488 B
Text

#include "../math/dot.cuh"
#include "../math/length.cuh"
/*
contributors: Inigo Quiles
description: generate the SDF of a plane
use: <float> planeSDF( in <float3> pos, in <vec2> h )
*/
#ifndef FNC_PLANESDF
#define FNC_PLANESDF
inline __host__ __device__ float planeSDF(float3 p) { return p.y; }
inline __host__ __device__ float planeSDF(float3 p, float3 planePoint, float3 planeNormal) { return (dot(planeNormal, p) + dot(planeNormal, planePoint)) / length(planeNormal); }
#endif