diff options
author | rodri <rgl@antares-labs.eu> | 2024-01-14 23:10:35 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-01-14 23:10:35 +0000 |
commit | ef9b5a48bd91757a3ebc0a4f0006c9f98737c205 (patch) | |
tree | b2e456a50e1964ffada0132ef46421a23af599df /main.c | |
parent | 88b8681339b85e27e3d1d98c867ac3aa0557f780 (diff) | |
download | tinyrend-ef9b5a48bd91757a3ebc0a4f0006c9f98737c205.tar.gz tinyrend-ef9b5a48bd91757a3ebc0a4f0006c9f98737c205.tar.bz2 tinyrend-ef9b5a48bd91757a3ebc0a4f0006c9f98737c205.zip |
add a model of the earth. do texture mapping based on picture format (RGB24, RGBA32 atm.)
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -285,7 +285,14 @@ rasterize(SUparams *params, Triangle3 st, Triangle2 tt, Memimage *frag) tp.x = (tt₂.p0.x + tt₂.p1.x + tt₂.p2.x)*Dx(modeltex->r); tp.y = (1 - (tt₂.p0.y + tt₂.p1.y + tt₂.p2.y))*Dy(modeltex->r); - unloadmemimage(modeltex, rectaddpt(Rect(0,0,1,1), tp), cbuf+1, sizeof cbuf - 1); + switch(modeltex->chan){ + case RGB24: + unloadmemimage(modeltex, rectaddpt(Rect(0,0,1,1), tp), cbuf+1, sizeof cbuf - 1); + break; + case RGBA32: + unloadmemimage(modeltex, rectaddpt(Rect(0,0,1,1), tp), cbuf, sizeof cbuf); + break; + } }else memset(cbuf+1, 0xFF, sizeof cbuf - 1); |