--- ray/src/rt/rv3.c 1995/01/25 16:08:57 2.8 +++ ray/src/rt/rv3.c 2003/07/21 22:30:19 2.13 @@ -1,21 +1,18 @@ -/* Copyright (c) 1994 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: rv3.c,v 2.13 2003/07/21 22:30:19 schorsch Exp $"; #endif - /* * rv3.c - miscellaneous routines for rview. * - * 5/11/87 + * External symbols declared in rpaint.h */ -#include "ray.h" +#include "copyright.h" -#include "octree.h" +#include +#include "ray.h" #include "rpaint.h" - #include "random.h" #ifndef WFLUSH @@ -33,6 +30,7 @@ static char SCCSid[] = "$SunId$ LBL"; #endif +int getrect(s, r) /* get a box */ char *s; register RECT *r; @@ -79,6 +77,7 @@ register RECT *r; } +int getinterest(s, direc, vec, mp) /* get area of interest */ char *s; int direc; @@ -143,11 +142,11 @@ register COLOR col; } +void paint(p, xmin, ymin, xmax, ymax) /* compute and paint a rectangle */ register PNODE *p; int xmin, ymin, xmax, ymax; { - extern unsigned long nrays; static unsigned long lastflush = 0; static RAY thisray; double h, v; @@ -185,6 +184,7 @@ int xmin, ymin, xmax, ymax; } +void newimage() /* start a new image */ { /* free old image */ @@ -205,6 +205,7 @@ newimage() /* start a new image */ } +void redraw() /* redraw the image */ { (*dev->clear)(hresolu, vresolu); @@ -214,6 +215,7 @@ redraw() /* redraw the image */ } +void repaint(xmin, ymin, xmax, ymax) /* repaint a region */ int xmin, ymin, xmax, ymax; { @@ -226,6 +228,7 @@ int xmin, ymin, xmax, ymax; } +void paintrect(p, xmin, ymin, xmax, ymax, r) /* paint picture rectangle */ register PNODE *p; int xmin, ymin, xmax, ymax; @@ -296,6 +299,7 @@ int pd; } +void scalepict(p, sf) /* scale picture values */ register PNODE *p; double sf; @@ -312,6 +316,7 @@ double sf; } +void getpictcolrs(yoff, scan, p, xsiz, ysiz) /* get scanline from picture */ int yoff; register COLR *scan; @@ -342,15 +347,7 @@ int xsiz, ysiz; } -pcopy(p1, p2) /* copy paint node p1 into p2 */ -register PNODE *p1, *p2; -{ - copycolor(p2->v, p1->v); - p2->x = p1->x; - p2->y = p1->y; -} - - +void freepkids(p) /* free pnode's children */ register PNODE *p; { @@ -360,11 +357,12 @@ register PNODE *p; freepkids(p->kid+DR); freepkids(p->kid+UL); freepkids(p->kid+UR); - free((char *)p->kid); + free((void *)p->kid); p->kid = NULL; } +void newview(vp) /* change viewing parameters */ register VIEW *vp; { @@ -373,14 +371,15 @@ register VIEW *vp; if ((err = setview(vp)) != NULL) { sprintf(errmsg, "view not set - %s", err); error(COMMAND, errmsg); - } else if (bcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) { - copystruct(&oldview, &ourview); - copystruct(&ourview, vp); + } else if (memcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) { + oldview = ourview; + ourview = *vp; newimage(); } } +void moveview(angle, elev, mag, vc) /* move viewpoint */ double angle, elev, mag; FVECT vc; @@ -425,15 +424,39 @@ FVECT vc; } -zoomview(vp, zf) /* zoom in our out */ +void +pcopy(p1, p2) /* copy paint node p1 into p2 */ +register PNODE *p1, *p2; +{ + copycolor(p2->v, p1->v); + p2->x = p1->x; + p2->y = p1->y; +} + + +void +zoomview(vp, zf) /* zoom in or out */ register VIEW *vp; double zf; { switch (vp->type) { case VT_PAR: /* parallel view */ + vp->horiz /= zf; + vp->vert /= zf; + return; case VT_ANG: /* angular fisheye */ vp->horiz /= zf; + if (vp->horiz > 360.) + vp->horiz = 360.; vp->vert /= zf; + if (vp->vert > 360.) + vp->vert = 360.; + return; + case VT_CYL: /* cylindrical panorama */ + vp->horiz /= zf; + if (vp->horiz > 360.) + vp->horiz = 360.; + vp->vert = atan(tan(vp->vert*(PI/180./2.))/zf) / (PI/180./2.); return; case VT_PER: /* perspective view */ vp->horiz = atan(tan(vp->horiz*(PI/180./2.))/zf) /