1 /* Copyright (C) 1992-1998 The Geometry Center
2  * Copyright (C) 1998-2000 Stuart Levy, Tamara Munzner, Mark Phillips
3  *
4  * This file is part of Geomview.
5  *
6  * Geomview is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License as published
8  * by the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * Geomview is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with Geomview; see the file COPYING.  If not, write
18  * to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
19  * USA, or visit http://www.gnu.org.
20  */
21 
22 
23 /* Authors: Charlie Gunn, Stuart Levy, Tamara Munzner, Mark Phillips */
24 
25 #ifndef CAMERAP_H
26 #define CAMERAP_H
27 
28 #include "camera.h"
29 #include "appearance.h"
30 
31 #define	CAMMAGIC	0x9c816301
32 
33 struct Camera {
34     REFERENCEFIELDS;
35     Handle	*c2whandle;	/* Handle for external camtoworld's */
36     Transform	camtoworld;	/* this moves the camera to its spot */
37     Handle	*w2chandle;	/* Handle for external worldtocam's */
38     Transform 	worldtocam;	/* this puts the camera at the origin, etc*/
39     int 	flag;		/* perspective?  stereo? */
40     float	halfyfield,	/* FOV half-width at z=1 (Y direction) */
41     		frameaspect,	/* Aspect ratio, X/Y */
42     		focus,		/* Nominal focal distance for perspec<->ortho*/
43     		cnear, cfar,	/* Near & far clipping distances */
44     		stereo_sep,
45 		stereo_angle;
46     Handle	*sterhandle[2];
47     Transform	stereyes[2];	/* For stereo separation */
48     int		whicheye;	/* Current stereo eye selection */
49     int		changed;	/* Mask of "changed" fields, for CamMerge */
50     int		space;		/* TM_EUCLIDEAN, TM_HYPERBOLIC, or TM_SPHERICAL */
51 #if 1
52     /* cH: Background information. Does this belong here? I think
53      * so. The background layout is clearly no property of the drawing
54      * routines (mg-layer), and it has nothing to do with the window
55      * system. Arguably it also has nothing to do with the camera, but
56      * would be a global property of the entire scene. OTH, it is nice
57      * to have cameras with different backgrounds, at least with
58      * different background colours.
59      *
60      * Note that this image is not scaled, it just sits at the center
61      * of the window (if the underlying mg-routines support a
62      * background image at all). The mg-layer may or may not use alpha
63      * blending with the background color if this is a four channel
64      * image.
65      */
66     ColorA      bgcolor;       /* background color */
67     Image       *bgimage;      /* background image, potentionally with alpha */
68     Handle      *bgimghandle;  /* handle for background image */
69 #endif
70 };
71 
72 /* bits for 'flag' and 'changed' fields */
73 #define	CAMF_PERSP		0x01
74 #define	CAMF_STEREO		0x02
75 #define	CAMF_NEWC2W		0x04
76 
77 /* bits for 'changed' only */
78 
79 #define	CAMF_EYE		0x20
80 #define	CAMF_STEREOXFORM	0x40
81 #define	CAMF_STEREOGEOM		0x80
82 #define	CAMF_W2C		0x100
83 #define	CAMF_FOV		0x200
84 #define	CAMF_ASPECT		0x400
85 #define	CAMF_FOCUS		0x800
86 #define	CAMF_NEAR		0x1000
87 #define	CAMF_FAR		0x2000
88 #define CAMF_SPACE		0x4000
89 
90 /*
91  * routine for updating transforms
92  */
93 void CamTransUpdate(Handle **, Camera *, Transform);
94 
95 #endif /* !CAMERAP_H */
96 
97 /*
98  * Local Variables: ***
99  * mode: c ***
100  * c-basic-offset: 4 ***
101  * End: ***
102  */
103