summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--med.c14
-rw-r--r--projtest.c2
-rw-r--r--solar.c8
-rw-r--r--vis.c16
4 files changed, 26 insertions, 14 deletions
diff --git a/med.c b/med.c
index f9f3bf6..216fbbe 100644
--- a/med.c
+++ b/med.c
@@ -125,9 +125,9 @@ materializefrustum(void)
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 @@ drawstats(void)
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 @@ void
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();
diff --git a/projtest.c b/projtest.c
index 76373e7..d034c56 100644
--- a/projtest.c
+++ b/projtest.c
@@ -38,7 +38,7 @@ threadmain(int argc, char *argv[])
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);
diff --git a/solar.c b/solar.c
index 948e24c..b8f1953 100644
--- a/solar.c
+++ b/solar.c
@@ -369,7 +369,11 @@ drawstats(void)
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 @@ redraw(void)
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++){
diff --git a/vis.c b/vis.c
index ccbeb26..abdc2ed 100644
--- a/vis.c
+++ b/vis.c
@@ -480,7 +480,11 @@ drawstats(void)
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 @@ redraw(void)
{
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 @@ lmb(void)
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);
}