summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-09-14 11:09:26 +0000
committerrodri <rgl@antares-labs.eu>2024-09-14 11:09:26 +0000
commit4e60c43745f430182eb44b40e69d8a9dac4b44e1 (patch)
tree2847a7e9d5f65c13c1f94ace6e2f529544bac8a4
parent3c16d2adc58ea335203c24d34b58b2f51bf55da6 (diff)
download3dee-4e60c43745f430182eb44b40e69d8a9dac4b44e1.tar.gz
3dee-4e60c43745f430182eb44b40e69d8a9dac4b44e1.tar.bz2
3dee-4e60c43745f430182eb44b40e69d8a9dac4b44e1.zip
vis: add an MMB option to show the z-buffer.
-rw-r--r--vis.c11
1 files changed, 8 insertions, 3 deletions
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)