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. --- scene.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'scene.c') diff --git a/scene.c b/scene.c index 5cd547e..f003e83 100644 --- a/scene.c +++ b/scene.c @@ -159,18 +159,9 @@ loadobjmodel(Model *m, OBJ *obj) if(mtl->name == nil) sysfatal("strdup: %r"); } - mtl->ambient.r = objmtl->Ka.r; - mtl->ambient.g = objmtl->Ka.g; - mtl->ambient.b = objmtl->Ka.b; - mtl->ambient.a = 1; - mtl->diffuse.r = objmtl->Kd.r; - mtl->diffuse.g = objmtl->Kd.g; - mtl->diffuse.b = objmtl->Kd.b; - mtl->diffuse.a = 1; - mtl->specular.r = objmtl->Ks.r; - mtl->specular.g = objmtl->Ks.g; - mtl->specular.b = objmtl->Ks.b; - mtl->specular.a = 1; + mtl->ambient = Pt3(objmtl->Ka.r, objmtl->Ka.g, objmtl->Ka.b, 1); + mtl->diffuse = Pt3(objmtl->Kd.r, objmtl->Kd.g, objmtl->Kd.b, 1); + mtl->specular = Pt3(objmtl->Ks.r, objmtl->Ks.g, objmtl->Ks.b, 1); mtl->shininess = objmtl->Ns; if(objmtl->map_Kd != nil){ @@ -419,7 +410,6 @@ void clearscene(Scene *s) { Entity *e, *ne; - int i; for(e = s->ents.next; e != &s->ents; e = ne){ ne = e->next; -- cgit v1.2.3