--- ray/src/hd/rhdisp.c 1998/06/17 15:44:07 3.26 +++ ray/src/hd/rhdisp.c 1998/08/19 18:23:56 3.31 @@ -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; @@ -273,7 +280,7 @@ again: if (!dev_view(v)) /* notify display driver */ goto again; dev_flush(); /* update screen */ - beam_init(); /* compute new beam set */ + beam_init(0); /* compute new beam set */ for (i = 0; (dv = dev_auxview(i, res)) != NULL; i++) if (!beam_view(dv, res[0], res[1])) { if (!nhist) { @@ -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");