--- ray/src/hd/rhdisp.c 1998/07/13 17:55:51 3.27 +++ ray/src/hd/rhdisp.c 1998/08/26 13:06:09 3.32 @@ -88,14 +88,6 @@ char *argv[]; printview(); if (inp & DFL(DC_LASTVIEW)) new_view(NULL); - if (inp & DFL(DC_RESUME)) { - serv_request(DR_NOOP, 0, NULL); - pause = 0; - } - if (inp & DFL(DC_PAUSE)) - pause = 1; - if (inp & DFL(DC_REDRAW)) - imm_mode = beam_sync(1) > 0; if (inp & DFL(DC_KILL)) { serv_request(DR_KILL, 0, NULL); pause = 0; @@ -106,6 +98,14 @@ char *argv[]; serv_request(DR_RESTART, 0, NULL); pause = 0; } + if (inp & DFL(DC_RESUME)) { + serv_request(DR_NOOP, 0, NULL); + pause = 0; + } + if (inp & DFL(DC_PAUSE)) + pause = 1; + if (inp & DFL(DC_REDRAW)) + imm_mode = beam_sync(1) > 0; if (inp & DFL(DC_QUIT)) serv_request(DR_SHUTDOWN, 0, NULL); } @@ -146,13 +146,18 @@ disp_wait() /* wait for more input */ int n; register int i; /* see if we can avoid select call */ + flgs = 0; /* flag what's ready already */ if (imm_mode || stdin->_cnt > 0) - return(RDY_SRV); + flgs |= RDY_SRV; if (sstdin != NULL && sstdin->_cnt > 0) - return(RDY_SIN); - if (dev_flush()) + flgs |= RDY_SIN; + if (odev.inpready) + flgs |= RDY_DEV; + if (flgs) /* got something? */ + return(flgs); + if (dev_flush()) /* else flush output & check keyboard+mouse */ return(RDY_DEV); - /* make the call */ + /* if nothing, we need to call select */ FD_ZERO(&readset); FD_ZERO(&errset); FD_SET(0, &readset); FD_SET(0, &errset); @@ -171,7 +176,6 @@ disp_wait() /* wait for more input */ return(0); error(SYSTEM, "select call failure in disp_wait"); } - flgs = 0; /* flag what's ready */ if (FD_ISSET(0, &readset) || FD_ISSET(0, &errset)) flgs |= RDY_SRV; if (FD_ISSET(odev.ifd, &readset) || FD_ISSET(odev.ifd, &errset)) @@ -234,8 +238,11 @@ register PACKHEAD *p; for (i = p->nr; i--; ) { hdray(ro, rd, hdlist[p->hd], gc, packra(p)[i].r); d = hddepth(hdlist[p->hd], packra(p)[i].d); - VSUM(wp, ro, rd, d); /* might be behind viewpoint */ - dev_value(packra(p)[i].v, wp, rd); + if (d < .99*FHUGE) { + VSUM(wp, ro, rd, d); /* might be behind viewpoint */ + dev_value(packra(p)[i].v, rd, wp); + } else + dev_value(packra(p)[i].v, rd, NULL); } #ifdef DEBUG if (imm_mode) nimmrays += p->nr; @@ -305,7 +312,7 @@ usr_input() /* get user input and process it */ sstdin = NULL; return(-1); } - if (!*cmd) + if (*cmd == '\n') return(DC_RESUME); for (args = cmd; *args && !isspace(*args); args++) ; @@ -406,7 +413,7 @@ serv_result() /* get next server result and process break; case DS_OUTSECT: do_outside = 1; - break; + goto noargs; case DS_EYESEP: if (msg.nbytes <= 1 || (eyesepdist = atof(buf)) <= FTINY) error(INTERNAL, "bad eye separation from server"); @@ -422,20 +429,21 @@ serv_result() /* get next server result and process } #endif imm_mode = msg.type==DS_STARTIMM; - /* fall through */ + goto noargs; case DS_ACKNOW: case DS_SHUTDOWN: - if (msg.nbytes) { - sprintf(errmsg, - "unexpected body with server message %d", - msg.type); - error(INTERNAL, errmsg); - } - break; + goto noargs; default: error(INTERNAL, "unrecognized result from server process"); } return(msg.type); /* return message type */ +noargs: + if (msg.nbytes) { + sprintf(errmsg, "unexpected body with server message %d", + msg.type); + error(INTERNAL, errmsg); + } + return(msg.type); readerr: if (feof(stdin)) error(SYSTEM, "server process died");