diff options
author | rodri <rgl@antares-labs.eu> | 2024-05-28 16:56:31 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-05-28 16:56:31 +0000 |
commit | 5fa75a6d4b03c676112ca04cf5ff3f3ccd2f0fee (patch) | |
tree | 5cc54afbf965a81c5f101f27fec25d1700a9b4d2 | |
parent | 7739f20ce8608c0613552e430f31008705050bf1 (diff) | |
download | libgraphics-5fa75a6d4b03c676112ca04cf5ff3f3ccd2f0fee.tar.gz libgraphics-5fa75a6d4b03c676112ca04cf5ff3f3ccd2f0fee.tar.bz2 libgraphics-5fa75a6d4b03c676112ca04cf5ff3f3ccd2f0fee.zip |
add a normal map property to Material.
-rw-r--r-- | graphics.h | 1 | ||||
-rw-r--r-- | scene.c | 7 |
2 files changed, 8 insertions, 0 deletions
@@ -108,6 +108,7 @@ struct Material Color specular; double shininess; Memimage *diffusemap; + Memimage *normalmap; }; struct Primitive @@ -180,6 +180,13 @@ loadobjmodel(Model *m, OBJ *obj) mtl->diffusemap->data->ref++; } + if(objmtl->norm != nil){ + mtl->normalmap = allocmemimaged(objmtl->norm->r, objmtl->norm->chan, objmtl->norm->data); + if(mtl->normalmap == nil) + sysfatal("allocmemimaged: %r"); + mtl->normalmap->data->ref++; + } + addmtlmap(&mtlmap, objmtl, m->nmaterials-1); } |