From 213c3a4e99c3085ee89fda550897213abbc888ad Mon Sep 17 00:00:00 2001 From: rodri Date: Mon, 10 Jun 2024 15:59:57 +0000 Subject: add spotlight params and a light color shading routine. other things. among these other things are clamping the color channels to [0,1] internally, and adding a modulation function for mixing colors/points. --- util.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'util.c') diff --git a/util.c b/util.c index e114da5..db538a3 100644 --- a/util.c +++ b/util.c @@ -52,6 +52,18 @@ swappt(Point *a, Point *b) *b = t; } +Point2 +modulapt2(Point2 a, Point2 b) +{ + return (Point2){a.x*b.x, a.y*b.y, a.w*b.w}; +} + +Point3 +modulapt3(Point3 a, Point3 b) +{ + return (Point3){a.x*b.x, a.y*b.y, a.z*b.z, a.w*b.w}; +} + void memsetd(double *p, double v, usize len) { -- cgit v1.2.3