aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-02-12 23:04:38 +0000
committerrodri <rgl@antares-labs.eu>2024-02-12 23:04:38 +0000
commit928376d9c31af304430276eb88fad7fc10d0be9d (patch)
treed69d685b71a3c503fd198bc76de83cc84021291b /main.c
parentbc68a4014a8321eede5851fe33ac7acd199ec3f9 (diff)
download3dee-928376d9c31af304430276eb88fad7fc10d0be9d.tar.gz
3dee-928376d9c31af304430276eb88fad7fc10d0be9d.tar.bz2
3dee-928376d9c31af304430276eb88fad7fc10d0be9d.zip
add a knob to toggle the hud stats.
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/main.c b/main.c
index 226ac15..1eeed32 100644
--- a/main.c
+++ b/main.c
@@ -36,6 +36,7 @@ Rune keys[Ke] = {
[Kcam1] = KF|2,
[Kcam2] = KF|3,
[Kcam3] = KF|4,
+ [Khud] = 'h',
};
char stats[Se][256];
Memimage *screenfb;
@@ -67,13 +68,14 @@ Camcfg camcfgs[4] = {
2,0,4,1,
0,0,0,1,
0,1,0,0,
- 120*DEG, 0.01, 100, PERSPECTIVE
+ 80*DEG, 0.01, 100, PERSPECTIVE
};
Point3 center = {0,0,0,1};
Point3 light = {0,1,1,1}; /* global point light */
static int doprof;
static int inception;
+static int showhud;
static int
min(int a, int b)
@@ -107,7 +109,7 @@ Point3
vertshader(VSparams *sp)
{
sp->v->n = qrotate(sp->v->n, Vec3(0,1,0), θ+fmod(ω*sp->su->uni_time/1e9, 2*PI));
- sp->su->var_intensity[sp->idx] = fmax(0, dotvec3(sp->v->n, light));
+ sp->v->intensity = fmax(0, dotvec3(sp->v->n, light));
sp->v->p = qrotate(sp->v->p, Vec3(0,1,0), θ+fmod(ω*sp->su->uni_time/1e9, 2*PI));
return world2clip(maincam, sp->v->p);
}
@@ -314,7 +316,8 @@ redraw(void)
lockdisplay(display);
loadimage(screen, rectaddpt(screenfb->r, screen->r.min), byteaddr(screenfb, screenfb->r.min), bytesperline(screenfb->r, screenfb->depth)*Dy(screenfb->r));
// drawaxis();
- drawstats();
+ if(showhud)
+ drawstats();
flushimage(display, 1);
unlockdisplay(display);
}
@@ -426,6 +429,8 @@ keyproc(void *c)
void
handlekeys(void)
{
+ static int okdown;
+
if(kdown & 1<<K↑)
placecamera(maincam, subpt3(maincam->p, mulpt3(maincam->bz, 0.1)), maincam->bz, maincam->by);
if(kdown & 1<<K↓)
@@ -458,6 +463,11 @@ handlekeys(void)
maincam = &cams[2];
if(kdown & 1<<Kcam3)
maincam = &cams[3];
+
+ if((okdown & 1<<Khud) == 0 && (kdown & 1<<Khud) != 0)
+ showhud ^= 1;
+
+ okdown = kdown;
}
void