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. --- graphics.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'graphics.h') diff --git a/graphics.h b/graphics.h index b7cfdce..b30dd9f 100644 --- a/graphics.h +++ b/graphics.h @@ -104,8 +104,12 @@ struct Vertex struct LightSource { Point3 p; + Point3 dir; Color c; int type; + /* spotlights */ + double θu; /* umbra angle. anything beyond is unlit */ + double θp; /* penumbra angle. anything within is fully lit */ }; struct Material @@ -330,11 +334,14 @@ Color cubemaptexture(Cubemap*, Point3, Color(*)(Memimage*, Point2)); /* util */ double fmin(double, double); double fmax(double, double); +Point2 modulapt2(Point2, Point2); +Point3 modulapt3(Point3, Point3); Memimage *rgb(ulong); /* shadeop */ double sign(double); double step(double, double); double smoothstep(double, double, double); +Color getlightcolor(LightSource*, Point3); extern Rectangle UR; /* unit rectangle */ -- cgit v1.2.3