From 4e60c43745f430182eb44b40e69d8a9dac4b44e1 Mon Sep 17 00:00:00 2001 From: rodri Date: Sat, 14 Sep 2024 11:09:26 +0000 Subject: vis: add an MMB option to show the z-buffer. --- vis.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index cfb1227..823aba5 100644 --- a/vis.c +++ b/vis.c @@ -92,7 +92,7 @@ static int showskybox; static int doprof; static int inception; static int showhud; -static int shownormals; +static char *curraster; static int blendon; static int depthon; static int abuffon; @@ -612,7 +612,7 @@ renderproc(void *) if(Δt > HZ2MS(60)*1000000ULL){ lockdisplay(display); draw(screenb, screenb->r, clr, nil, ZP); - maincam->view->draw(maincam->view, screenb, shownormals? "normals": nil); + maincam->view->draw(maincam->view, screenb, curraster); unlockdisplay(display); nbsend(drawc, nil); t0 += Δt; @@ -705,6 +705,7 @@ mmb(void) TSBILINEAR, SP1, SHOWNORMALS, + SHOWZBUFFER, SP2, SETCLRCOL, SP3, @@ -723,6 +724,7 @@ mmb(void) [TSBILINEAR] "use bilinear sampler", "", [SHOWNORMALS] "show normals", + [SHOWZBUFFER] "show z-buffer", "", [SETCLRCOL] "set clear color", "", @@ -760,7 +762,10 @@ mmb(void) tsampler = bilitexsampler; break; case SHOWNORMALS: - shownormals ^= 1; + curraster = curraster && strcmp(curraster, "normals") == 0? nil: "normals"; + break; + case SHOWZBUFFER: + curraster = curraster && strcmp(curraster, "z-buffer") == 0? nil: "z-buffer"; break; case SETCLRCOL: if(unloadimage(clr, UR, (uchar*)&clrcol, 4) != 4) -- cgit v1.2.3