--- ray/src/common/view.h 1989/02/02 10:34:24 1.1 +++ ray/src/common/view.h 1994/12/20 20:15:06 2.4 @@ -1,4 +1,4 @@ -/* Copyright (c) 1988 Regents of the University of California */ +/* Copyright (c) 1994 Regents of the University of California */ /* SCCSid "$SunId$ LBL" */ @@ -11,6 +11,8 @@ /* view types */ #define VT_PER 'v' /* perspective */ #define VT_PAR 'l' /* parallel */ +#define VT_ANG 'a' /* angular fisheye */ +#define VT_HEM 'h' /* hemispherical fisheye */ typedef struct { int type; /* view type */ @@ -19,16 +21,27 @@ typedef struct { FVECT vup; /* view up */ double horiz; /* horizontal view size */ double vert; /* vertical view size */ - int hresolu; /* horizontal resolution */ - int vresolu; /* vertical resolution */ - FVECT vhinc; /* computed horizontal increment */ - FVECT vvinc; /* computed vertical increment */ + double hoff; /* horizontal image offset */ + double voff; /* vertical image offset */ + double vfore; /* fore clipping plane */ + double vaft; /* aft clipping plane (<=0 for inf) */ + FVECT hvec; /* computed horizontal image vector */ + FVECT vvec; /* computed vertical image vector */ + double hn2; /* DOT(hvec,hvec) */ + double vn2; /* DOT(vvec,vvec) */ } VIEW; /* view parameters */ extern VIEW stdview; extern char *setview(); -#define STDVIEW(h) {VT_PER,0.,0.,0.,0.,1.,0.,0.,0.,1.,45.,45.,h,h} +extern double viewray(); +#define viewaspect(v) sqrt((v)->vn2/(v)->hn2) + +#define STDVIEW {VT_PER,{0.,0.,0.},{0.,1.,0.},{0.,0.,1.}, \ + 45.,45.,0.,0.,0.,0., \ + {0.,0.,0.},{0.,0.,0.},0.,0.} + #define VIEWSTR "VIEW=" +#define VIEWSTRL 5