Skip to content

Commit

Permalink
Update functions.cpp
Browse files Browse the repository at this point in the history
edit floor function to match GLSL implementation
  • Loading branch information
herronelou authored Mar 26, 2020
1 parent 153f368 commit 3c8e834
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion blink_snippets/functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ float remap(float val, float ori_min, float ori_max, float new_min, float new_ma
}

// Fract
float fract (float x) {return fabs(x)-floor(fabs(x));}
float fract (float x) {return x-floor(x);}
float2 fract (float2 x) {return x-floor(x);}
float3 fract (float3 x) {return x-floor(x);}
float4 fract (float4 x) {return x-floor(x);}

// Random
random(float co) { return fract(sin(co*(91.3458f)) * 47453.5453f); }

0 comments on commit 3c8e834

Please sign in to comment.