ref: 2bb3478036293fc1a6dc283953178b1e258eb6e5
parent: eddb2d366ba452ff2993aa4c827150767a1fcc59
author: rodri <rgl@antares-labs.eu>
date: Sun Jul 14 04:33:27 EDT 2024
fixes.
--- a/med.c
+++ b/med.c
@@ -125,9 +125,9 @@
int i;
p[0] = Pt3(0,0,1,1);
- p[1] = Pt3(Dx(cam->vp->r),0,1,1);
- p[2] = Pt3(Dx(cam->vp->r),Dy(cam->vp->r),1,1);
- p[3] = Pt3(0,Dy(cam->vp->r),1,1);
+ p[1] = Pt3(Dx(cam->view->r),0,1,1);
+ p[2] = Pt3(Dx(cam->view->r),Dy(cam->view->r),1,1);
+ p[3] = Pt3(0,Dy(cam->view->r),1,1);
memset(&l, 0, sizeof l);
for(i = 0; i < nelem(p); i++){
@@ -456,7 +456,11 @@
snprint(stats[Scambx], sizeof(stats[Scambx]), "bx %V", cam->bx);
snprint(stats[Scamby], sizeof(stats[Scamby]), "by %V", cam->by);
snprint(stats[Scambz], sizeof(stats[Scambz]), "bz %V", cam->bz);
- snprint(stats[Sfps], sizeof(stats[Sfps]), "FPS %.0f/%.0f/%.0f/%.0f", !cam->stats.max? 0: 1e9/cam->stats.max, !cam->stats.avg? 0: 1e9/cam->stats.avg, !cam->stats.min? 0: 1e9/cam->stats.min, !cam->stats.v? 0: 1e9/cam->stats.v);
+ snprint(stats[Sfps], sizeof(stats[Sfps]), "FPS %.0f/%.0f/%.0f/%.0f",
+ !cam->stats.max? 0: 1e9/cam->stats.max,
+ !cam->stats.avg? 0: 1e9/cam->stats.avg,
+ !cam->stats.min? 0: 1e9/cam->stats.min,
+ !cam->stats.v? 0: 1e9/cam->stats.v);
snprint(stats[Sframes], sizeof(stats[Sframes]), "frame %llud", cam->stats.nframes);
for(i = 0; i < Se; i++)
stringbg(screen, addpt(screen->r.min, Pt(10,10 + i*font->height)), display->black, ZP, font, stats[i], display->white, ZP);
@@ -466,7 +470,7 @@
redraw(void)
{
lockdisplay(display);
- cam->vp->draw(cam->vp, screenb);
+ cam->view->draw(cam->view, screenb);
draw(screen, screen->r, screenb, nil, ZP);
if(showhud)
drawstats();
--- a/projtest.c
+++ b/projtest.c
@@ -38,7 +38,7 @@
cam = Cam(Rect(0,0,640,480), nil, PERSPECTIVE, 40*DEG, 0.01, 10);
placecamera(cam, nil, Pt3(0,0,1,1), Vec3(0,0,0), Vec3(0,1,0));
- fb = cam->vp->getfb(cam->vp);
+ fb = cam->view->getfb(cam->view);
np = Pt3(0,0,-0.01,1);
fp = Pt3(0,0,-10,1);
fprint(2, "near %V\nfar %V\n", np, fp);
--- a/solar.c
+++ b/solar.c
@@ -369,7 +369,11 @@
snprint(stats[Scambx], sizeof(stats[Scambx]), "bx %V", camera->bx);
snprint(stats[Scamby], sizeof(stats[Scamby]), "by %V", camera->by);
snprint(stats[Scambz], sizeof(stats[Scambz]), "bz %V", camera->bz);
- snprint(stats[Sfps], sizeof(stats[Sfps]), "FPS %.0f/%.0f/%.0f/%.0f", !camera->stats.max? 0: 1e9/camera->stats.max, !camera->stats.avg? 0: 1e9/camera->stats.avg, !camera->stats.min? 0: 1e9/camera->stats.min, !camera->stats.v? 0: 1e9/camera->stats.v);
+ snprint(stats[Sfps], sizeof(stats[Sfps]), "FPS %.0f/%.0f/%.0f/%.0f",
+ !camera->stats.max? 0: 1e9/camera->stats.max,
+ !camera->stats.avg? 0: 1e9/camera->stats.avg,
+ !camera->stats.min? 0: 1e9/camera->stats.min,
+ !camera->stats.v? 0: 1e9/camera->stats.v);
snprint(stats[Sframes], sizeof(stats[Sframes]), "frame %llud", camera->stats.nframes);
snprint(stats[Splanet], sizeof(stats[Splanet]), "%s", selplanet == nil? "": selplanet->name);
for(i = 0; i < Se; i++)
@@ -382,7 +386,7 @@
int i;
lockdisplay(display);
- camera->vp->draw(camera->vp, screenb);
+ camera->view->draw(camera->view, screenb);
draw(screen, rectaddpt(viewr, screen->r.min), screenb, nil, ZP);
draw(screen, rectaddpt(cmdbox.r, screen->r.min), display->white, nil, ZP);
for(i = 0; i < cmdbox.ncmds; i++){
--- a/vis.c
+++ b/vis.c
@@ -480,7 +480,11 @@
snprint(stats[Scambx], sizeof(stats[Scambx]), "bx %V", maincam->bx);
snprint(stats[Scamby], sizeof(stats[Scamby]), "by %V", maincam->by);
snprint(stats[Scambz], sizeof(stats[Scambz]), "bz %V", maincam->bz);
- snprint(stats[Sfps], sizeof(stats[Sfps]), "FPS %.0f/%.0f/%.0f/%.0f", !maincam->stats.max? 0: 1e9/maincam->stats.max, !maincam->stats.avg? 0: 1e9/maincam->stats.avg, !maincam->stats.min? 0: 1e9/maincam->stats.min, !maincam->stats.v? 0: 1e9/maincam->stats.v);
+ snprint(stats[Sfps], sizeof(stats[Sfps]), "FPS %.0f/%.0f/%.0f/%.0f",
+ !maincam->stats.max? 0: 1e9/maincam->stats.max,
+ !maincam->stats.avg? 0: 1e9/maincam->stats.avg,
+ !maincam->stats.min? 0: 1e9/maincam->stats.min,
+ !maincam->stats.v? 0: 1e9/maincam->stats.v);
snprint(stats[Sframes], sizeof(stats[Sframes]), "frame %llud", maincam->stats.nframes);
snprint(stats[Sorient], sizeof(stats[Sorient]), "ℍ %V", (Point3)orient);
for(i = 0; i < Se; i++)
@@ -492,9 +496,9 @@
{
lockdisplay(display);
if(shownormals)
- maincam->vp->fbctl->drawnormals(maincam->vp->fbctl, screenb);
+ maincam->view->fbctl->drawnormals(maincam->view->fbctl, screenb);
else
- maincam->vp->draw(maincam->vp, screenb);
+ maincam->view->draw(maincam->view, screenb);
draw(screen, screen->r, screenb, nil, ZP);
if(showhud)
drawstats();
@@ -589,12 +593,12 @@
double z;
p = subpt(mctl->xy, screen->r.min);
- qlock(maincam->vp->fbctl);
- fb = maincam->vp->getfb(maincam->vp);
+ qlock(maincam->view->fbctl);
+ fb = maincam->view->getfb(maincam->view);
c = ul2col(fb->cb[p.y*Dx(fb->r) + p.x]);
n = ul2col(fb->nb[p.y*Dx(fb->r) + p.x]);
z = fb->zb[p.y*Dx(fb->r) + p.x];
- qunlock(maincam->vp->fbctl);
+ qunlock(maincam->view->fbctl);
snprint(stats[Spixcol], sizeof(stats[Spixcol]), "c %V z %g", c, z);
snprint(stats[Snorcol], sizeof(stats[Snorcol]), "n %V", n);
}