diff options
author | rodri <rgl@antares-labs.eu> | 2023-12-23 00:12:34 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2023-12-23 00:12:34 +0000 |
commit | b34446e7025a15bd5b74fd5f88bb952028cc8a4a (patch) | |
tree | bb6e51e0c63bcf4f167936fd8e7991da2bbb1ac1 /shadeop.c | |
parent | f69cd8f04bbe059ce21f0c7be93fd081495c6371 (diff) | |
download | tinyrend-b34446e7025a15bd5b74fd5f88bb952028cc8a4a.tar.gz tinyrend-b34446e7025a15bd5b74fd5f88bb952028cc8a4a.tar.bz2 tinyrend-b34446e7025a15bd5b74fd5f88bb952028cc8a4a.zip |
organize the code better.
Diffstat (limited to 'shadeop.c')
-rw-r--r-- | shadeop.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/shadeop.c b/shadeop.c new file mode 100644 index 0000000..c9d3353 --- /dev/null +++ b/shadeop.c @@ -0,0 +1,28 @@ +#include <u.h> +#include <libc.h> +#include <thread.h> +#include <draw.h> +#include <memdraw.h> +#include <mouse.h> +#include <keyboard.h> +#include <geometry.h> +#include "libobj/obj.h" +#include "dat.h" +#include "fns.h" + +double +step(double edge, double n) +{ + if(n < edge) + return 0; + return 1; +} + +double +smoothstep(double edge0, double edge1, double n) +{ + double t; + + t = fclamp((n-edge0)/(edge1-edge0), 0, 1); + return t*t * (3 - 2*t); +} |