summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--med.c4
-rw-r--r--solar.c4
-rw-r--r--vis.c19
3 files changed, 17 insertions, 10 deletions
diff --git a/med.c b/med.c
index 216fbbe..8de1656 100644
--- a/med.c
+++ b/med.c
@@ -470,7 +470,6 @@ void
redraw(void)
{
lockdisplay(display);
- cam->view->draw(cam->view, screenb);
draw(screen, screen->r, screenb, nil, ZP);
if(showhud)
drawstats();
@@ -498,6 +497,9 @@ renderproc(void *)
cam->times.Rn[cam->times.cur-1].t0, cam->times.Rn[cam->times.cur-1].t1);
Δt = nsec() - t0;
if(Δt > HZ2MS(60)*1000000ULL){
+ lockdisplay(display);
+ cam->view->draw(cam->view, screenb);
+ unlockdisplay(display);
nbsend(drawc, nil);
t0 += Δt;
}
diff --git a/solar.c b/solar.c
index b8f1953..12893ed 100644
--- a/solar.c
+++ b/solar.c
@@ -386,7 +386,6 @@ redraw(void)
int i;
lockdisplay(display);
- 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++){
@@ -417,6 +416,9 @@ renderproc(void *)
camera->times.Rn[camera->times.cur-1].t0, camera->times.Rn[camera->times.cur-1].t1);
Δt = nsec() - t0;
if(Δt > HZ2MS(60)*1000000ULL){
+ lockdisplay(display);
+ camera->view->draw(camera->view, screenb);
+ unlockdisplay(display);
nbsend(drawc, nil);
t0 += Δt;
}
diff --git a/vis.c b/vis.c
index c4ceb7c..445142d 100644
--- a/vis.c
+++ b/vis.c
@@ -495,10 +495,6 @@ void
redraw(void)
{
lockdisplay(display);
- if(shownormals)
- maincam->view->fbctl->drawnormals(maincam->view->fbctl, screenb);
- else
- maincam->view->draw(maincam->view, screenb);
draw(screen, screen->r, screenb, nil, ZP);
if(showhud)
drawstats();
@@ -529,12 +525,18 @@ renderproc(void *)
shootcamera(maincam, shader);
if(doprof)
fprint(2, "R %llud %llud\nE %llud %llud\nT %llud %llud\nr %llud %llud\n\n",
- maincam->times.R[maincam->times.cur-1].t0, maincam->times.R[maincam->times.cur-1].t1,
- maincam->times.E[maincam->times.cur-1].t0, maincam->times.E[maincam->times.cur-1].t1,
- maincam->times.Tn[maincam->times.cur-1].t0, maincam->times.Tn[maincam->times.cur-1].t1,
- maincam->times.Rn[maincam->times.cur-1].t0, maincam->times.Rn[maincam->times.cur-1].t1);
+ maincam->times.R[maincam->times.last].t0, maincam->times.R[maincam->times.last].t1,
+ maincam->times.E[maincam->times.last].t0, maincam->times.E[maincam->times.last].t1,
+ maincam->times.Tn[maincam->times.last].t0, maincam->times.Tn[maincam->times.last].t1,
+ maincam->times.Rn[maincam->times.last].t0, maincam->times.Rn[maincam->times.last].t1);
Δt = nsec() - t0;
if(Δt > HZ2MS(60)*1000000ULL){
+ lockdisplay(display);
+ if(shownormals)
+ maincam->view->fbctl->drawnormals(maincam->view->fbctl, screenb);
+ else
+ maincam->view->draw(maincam->view, screenb);
+ unlockdisplay(display);
nbsend(drawc, nil);
t0 += Δt;
if(inception){
@@ -946,6 +948,7 @@ threadmain(int argc, char *argv[])
placecamera(cams[i], scene, camcfgs[i].p, camcfgs[i].lookat, camcfgs[i].up);
cams[i]->view->bx.x = Dx(screenb->r)/Dx(cams[i]->view->r);
cams[i]->view->by.y = Dy(screenb->r)/Dy(cams[i]->view->r);
+fprint(2, "scalex %g scaley %g\n", cams[i]->view->bx.x, cams[i]->view->by.y);
}
maincam = cams[3];
light.p = Pt3(0,100,100,1);