diff options
author | rodri <rgl@antares-labs.eu> | 2024-02-10 19:00:31 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-02-10 19:00:31 +0000 |
commit | bc68a4014a8321eede5851fe33ac7acd199ec3f9 (patch) | |
tree | cc080480618fd751b4caf124974b265dc6af3cf5 | |
parent | ea09c17ebaeaa0e51a294a2a354ddcb845db9775 (diff) | |
download | 3dee-bc68a4014a8321eede5851fe33ac7acd199ec3f9.tar.gz 3dee-bc68a4014a8321eede5851fe33ac7acd199ec3f9.tar.bz2 3dee-bc68a4014a8321eede5851fe33ac7acd199ec3f9.zip |
reuse the modeltex for inception mode.
-rw-r--r-- | main.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -322,33 +322,32 @@ redraw(void) void drawproc(void *) { - Memimage *scrtex; uvlong t0, Δt; int fd; threadsetname("drawproc"); - scrtex = nil; fd = -1; if(inception){ fd = open("/dev/screen", OREAD); if(fd < 0) sysfatal("open: %r"); - if((scrtex = readmemimage(fd)) == nil) + freememimage(modeltex); + if((modeltex = readmemimage(fd)) == nil) sysfatal("readmemimage: %r"); } t0 = nsec(); for(;;){ - shootcamera(maincam, model, inception? scrtex: modeltex, shader); + shootcamera(maincam, model, modeltex, shader); Δt = nsec() - t0; if(Δt > HZ2MS(60)*1000000ULL){ nbsend(drawc, nil); t0 += Δt; if(inception){ - freememimage(scrtex); + freememimage(modeltex); seek(fd, 0, 0); - if((scrtex = readmemimage(fd)) == nil) + if((modeltex = readmemimage(fd)) == nil) sysfatal("readmemimage: %r"); } } |