1 |
< |
/* Copyright (c) 1988 Regents of the University of California */ |
2 |
< |
|
3 |
< |
/* SCCSid "$SunId$ LBL" */ |
4 |
< |
|
1 |
> |
/* RCSid: $Id$ */ |
2 |
|
/* |
3 |
|
* view.h - header file for image generation. |
4 |
|
* |
5 |
< |
* 9/19/88 |
5 |
> |
* Include after fvect.h |
6 |
> |
* Includes resolu.h |
7 |
|
*/ |
8 |
|
|
9 |
+ |
/* ==================================================================== |
10 |
+ |
* The Radiance Software License, Version 1.0 |
11 |
+ |
* |
12 |
+ |
* Copyright (c) 1990 - 2002 The Regents of the University of California, |
13 |
+ |
* through Lawrence Berkeley National Laboratory. All rights reserved. |
14 |
+ |
* |
15 |
+ |
* Redistribution and use in source and binary forms, with or without |
16 |
+ |
* modification, are permitted provided that the following conditions |
17 |
+ |
* are met: |
18 |
+ |
* |
19 |
+ |
* 1. Redistributions of source code must retain the above copyright |
20 |
+ |
* notice, this list of conditions and the following disclaimer. |
21 |
+ |
* |
22 |
+ |
* 2. Redistributions in binary form must reproduce the above copyright |
23 |
+ |
* notice, this list of conditions and the following disclaimer in |
24 |
+ |
* the documentation and/or other materials provided with the |
25 |
+ |
* distribution. |
26 |
+ |
* |
27 |
+ |
* 3. The end-user documentation included with the redistribution, |
28 |
+ |
* if any, must include the following acknowledgment: |
29 |
+ |
* "This product includes Radiance software |
30 |
+ |
* (http://radsite.lbl.gov/) |
31 |
+ |
* developed by the Lawrence Berkeley National Laboratory |
32 |
+ |
* (http://www.lbl.gov/)." |
33 |
+ |
* Alternately, this acknowledgment may appear in the software itself, |
34 |
+ |
* if and wherever such third-party acknowledgments normally appear. |
35 |
+ |
* |
36 |
+ |
* 4. The names "Radiance," "Lawrence Berkeley National Laboratory" |
37 |
+ |
* and "The Regents of the University of California" must |
38 |
+ |
* not be used to endorse or promote products derived from this |
39 |
+ |
* software without prior written permission. For written |
40 |
+ |
* permission, please contact [email protected]. |
41 |
+ |
* |
42 |
+ |
* 5. Products derived from this software may not be called "Radiance", |
43 |
+ |
* nor may "Radiance" appear in their name, without prior written |
44 |
+ |
* permission of Lawrence Berkeley National Laboratory. |
45 |
+ |
* |
46 |
+ |
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
47 |
+ |
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
48 |
+ |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
49 |
+ |
* DISCLAIMED. IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR |
50 |
+ |
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
51 |
+ |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
52 |
+ |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
53 |
+ |
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
54 |
+ |
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
55 |
+ |
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
56 |
+ |
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
57 |
+ |
* SUCH DAMAGE. |
58 |
+ |
* ==================================================================== |
59 |
+ |
* |
60 |
+ |
* This software consists of voluntary contributions made by many |
61 |
+ |
* individuals on behalf of Lawrence Berkeley National Laboratory. For more |
62 |
+ |
* information on Lawrence Berkeley National Laboratory, please see |
63 |
+ |
* <http://www.lbl.gov/>. |
64 |
+ |
*/ |
65 |
+ |
|
66 |
+ |
#include "resolu.h" |
67 |
+ |
|
68 |
|
/* view types */ |
69 |
|
#define VT_PER 'v' /* perspective */ |
70 |
|
#define VT_PAR 'l' /* parallel */ |
71 |
+ |
#define VT_ANG 'a' /* angular fisheye */ |
72 |
+ |
#define VT_HEM 'h' /* hemispherical fisheye */ |
73 |
+ |
#define VT_CYL 'c' /* cylindrical panorama */ |
74 |
|
|
75 |
|
typedef struct { |
76 |
|
int type; /* view type */ |
79 |
|
FVECT vup; /* view up */ |
80 |
|
double horiz; /* horizontal view size */ |
81 |
|
double vert; /* vertical view size */ |
82 |
< |
int hresolu; /* horizontal resolution */ |
83 |
< |
int vresolu; /* vertical resolution */ |
84 |
< |
FVECT vhinc; /* computed horizontal increment */ |
85 |
< |
FVECT vvinc; /* computed vertical increment */ |
86 |
< |
double vhs2; /* 1.0/DOT(vhinc,vhinc) */ |
87 |
< |
double vvs2; /* 1.0/DOT(vvinc,vvinc) */ |
82 |
> |
double hoff; /* horizontal image offset */ |
83 |
> |
double voff; /* vertical image offset */ |
84 |
> |
double vfore; /* fore clipping plane */ |
85 |
> |
double vaft; /* aft clipping plane (<=0 for inf) */ |
86 |
> |
FVECT hvec; /* computed horizontal image vector */ |
87 |
> |
FVECT vvec; /* computed vertical image vector */ |
88 |
> |
double hn2; /* DOT(hvec,hvec) */ |
89 |
> |
double vn2; /* DOT(vvec,vvec) */ |
90 |
|
} VIEW; /* view parameters */ |
91 |
|
|
92 |
|
extern VIEW stdview; |
93 |
|
|
94 |
< |
extern char *setview(); |
94 |
> |
#define viewaspect(v) sqrt((v)->vn2/(v)->hn2) |
95 |
|
|
96 |
< |
#define STDVIEW(h) {VT_PER,0.,0.,0.,0.,1.,0.,0.,0.,1.,45.,45.,h,h} |
96 |
> |
#define STDVIEW {VT_PER,{0.,0.,0.},{0.,1.,0.},{0.,0.,1.}, \ |
97 |
> |
45.,45.,0.,0.,0.,0., \ |
98 |
> |
{0.,0.,0.},{0.,0.,0.},0.,0.} |
99 |
|
|
100 |
|
#define VIEWSTR "VIEW=" |
101 |
+ |
#define VIEWSTRL 5 |
102 |
+ |
|
103 |
+ |
#ifdef NOPROTO |
104 |
+ |
|
105 |
+ |
extern char *setview(); |
106 |
+ |
extern void normaspect(); |
107 |
+ |
extern double viewray(); |
108 |
+ |
extern void viewloc(); |
109 |
+ |
extern void pix2loc(); |
110 |
+ |
extern void loc2pix(); |
111 |
+ |
extern int getviewopt(); |
112 |
+ |
extern int sscanview(); |
113 |
+ |
extern void fprintview(); |
114 |
+ |
extern char *viewopt(); |
115 |
+ |
extern int isview(); |
116 |
+ |
extern int viewfile(); |
117 |
+ |
|
118 |
+ |
#else |
119 |
+ |
|
120 |
+ |
extern char *setview(VIEW *v); |
121 |
+ |
extern void normaspect(double va, double *ap, int *xp, int *yp); |
122 |
+ |
extern double viewray(FVECT orig, FVECT direc, VIEW *v, double x, double y); |
123 |
+ |
extern void viewloc(FVECT ip, VIEW *v, FVECT p); |
124 |
+ |
extern void pix2loc(FLOAT loc[2], RESOLU *rp, int px, int py); |
125 |
+ |
extern void loc2pix(int pp[2], RESOLU *rp, double lx, double ly); |
126 |
+ |
extern int getviewopt(VIEW *v, int ac, char *av[]); |
127 |
+ |
extern int sscanview(VIEW *vp, char *s); |
128 |
+ |
extern void fprintview(VIEW *vp, FILE *fp); |
129 |
+ |
extern char *viewopt(VIEW *vp); |
130 |
+ |
extern int isview(char *s); |
131 |
+ |
extern int viewfile(char *fname, VIEW *vp, RESOLU *rp); |
132 |
+ |
|
133 |
+ |
#endif |