summaryrefslogtreecommitdiff
path: root/scene.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-06-10 15:59:57 +0000
committerrodri <rgl@antares-labs.eu>2024-06-10 15:59:57 +0000
commit213c3a4e99c3085ee89fda550897213abbc888ad (patch)
tree6dead68a5f64ca4d23285ab3dd13a7a36e4fea92 /scene.c
parent239a319b41474a35e4c9c4b7c6ae3c6e0b0b7185 (diff)
downloadlibgraphics-213c3a4e99c3085ee89fda550897213abbc888ad.tar.gz
libgraphics-213c3a4e99c3085ee89fda550897213abbc888ad.tar.bz2
libgraphics-213c3a4e99c3085ee89fda550897213abbc888ad.zip
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.
Diffstat (limited to 'scene.c')
-rw-r--r--scene.c16
1 files changed, 3 insertions, 13 deletions
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;