/usr/share/k3d/shaders/k3d_functions.h is in k3d-data 0.8.0.3-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* k3d_functions.h
*
* various functions collected from k3d_*.sl files
*
* add #include "k3d_functions.h" to your .sl files to use
*/
/*
* Basic Math
*/
#define sqr(x) ((x)*(x))
#define isOdd(x) ((mod(x,2) == 1) ? 1 : 0) /* also in rmnotes as odd(x) even(x) */
/*
* finters steps and pulses
*/
#define boxstep(a,b,x) clamp(((x)-(a))/((b)-(a)),0,1) /* also in rmnotes, but all that code will end up here anyway. */
#define smoothPulse(a, b, fuzz, loc) (smoothstep (a-fuzz, a+fuzz, loc) - smoothstep (b-fuzz, b+fuzz, loc) )
/* separate fuzzes */
#define smoothPulse2Fuzz(a, b, afuzz, bfuzz, loc) (smoothstep (a-afuzz, a, loc) - smoothstep (b, b+bfuzz, loc))
|