16 lines
No EOL
379 B
Text
16 lines
No EOL
379 B
Text
/*
|
|
contributors: Inigo Quiles
|
|
description: generate the SDF of a plane
|
|
use: <float> planeSDF( <float3> pos, <float2> h )
|
|
*/
|
|
|
|
#ifndef FNC_PLANESDF
|
|
#define FNC_PLANESDF
|
|
float planeSDF( float3 p ) {
|
|
return p.y;
|
|
}
|
|
|
|
float planeSDF(float3 p, float3 planePoint, float3 planeNormal) {
|
|
return (dot(planeNormal, p) + dot(planeNormal, planePoint)) / length(planeNormal);
|
|
}
|
|
#endif |