Open Inventor Reference
SoCamera.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1990,91 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.1.1.1 $
45 |
46 | Description:
47 | Abstract base camera node class
48 |
49 | Author(s) : Paul S. Strauss
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55#ifndef _SO_CAMERA_
56#define _SO_CAMERA_
57
58#include <Inventor/SbBox.h>
65
67
68
71
95
97
99
100 public:
104
107 CROP_VIEWPORT_FILL_FRAME = 0,
108 CROP_VIEWPORT_LINE_FRAME = 1,
109 CROP_VIEWPORT_NO_FRAME = 2,
110
111 ADJUST_CAMERA = 3,
112 LEAVE_ALONE = 4
114 };
115
120
122
123
127
130
134
143
148
150
155 void pointAt(const SbVec3f &targetPoint);
156
160 virtual void scaleHeight(float scaleFactor) = 0;
161
165 virtual SbViewVolume getViewVolume(float useAspectRatio = 0.0) const = 0;
166
172 void viewAll(SoNode *sceneRoot,
173 const SbViewportRegion &vpRegion,
174 float slack = 1.0);
175 void viewAll(SoPath *path,
176 const SbViewportRegion &vpRegion,
177 float slack = 1.0);
178
182
183 SoEXTENDER public:
184 virtual void doAction(SoAction *action);
185 virtual void callback(SoCallbackAction *action);
186 virtual void GLRender(SoGLRenderAction *action);
188 virtual void handleEvent(SoHandleEventAction *action);
189 virtual void rayPick(SoRayPickAction *action);
190
191 SoINTERNAL public:
192 static void initClass();
193
194 protected:
196 virtual ~SoCamera();
197
202 virtual void viewBoundingBox(const SbBox3f &box,
203 float aspect, float slack) = 0;
204
208 virtual void jitter(int numPasses, int curPass,
209 const SbViewportRegion &vpReg,
210 SbVec3f &jitterAmount) const;
211
212 private:
214 void computeView(const SbViewportRegion &vpReg,
215 SbViewVolume &viewVol,
216 bool &changeRegion);
217
219 void setElements(SoAction *action,
220 SbViewVolume &viewVol,
221 bool setRegion,
222 const SbViewportRegion &vpReg,
223 bool doJitter,
224 const SbVec3f &jitterAmount);
225
227 void drawFrame(SoGLRenderAction *action,
228 const SbViewportRegion &vpReg,
229 const SbViewportRegion &croppedReg);
230
232 static void getJitterSample(int numPasses, int curPass,
233 SbVec2f &samplePoint);
234};
235
240
241#define SO_ASPECT_SQUARE 1.00 /* Square (1.000) */
242#define SO_ASPECT_VIDEO 1.333333333 /* Video (0.75) */
243#define SO_ASPECT_35mm_ACADEMY 1.371 /* 35mm, Academy ap (.72939460) */
244#define SO_ASPECT_16mm 1.369 /* 16mm cinema (.730460189) */
245#define SO_ASPECT_35mm_FULL 1.33333 /* 35mm cinema, full ap (0.75) */
246#define SO_ASPECT_70mm 2.287 /* 70 mm unsqueezed (.43725404) */
247#define SO_ASPECT_CINEMASCOPE 2.35 /* Cinemascope (.425531914) */
248#define SO_ASPECT_HDTV 1.777777777 /* HDTV (16:9) */
249#define SO_ASPECT_PANAVISION 2.361 /* Panavision (.423549343) */
250#define SO_ASPECT_35mm 1.5 /* 35mm still camera (.666666) */
251#define SO_ASPECT_VISTAVISION 2.301 /* Vistavision (.434593654) */
252
253#endif /* _SO_CAMERA_ */
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition SbBasic.h:154
#define SoINTERNAL
Definition SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
#define SO_NODE_ABSTRACT_HEADER(className)
Macros to be called within the class definition header for a node subclass:
Definition SoSubNode.h:150
3D box class.
Definition SbBox.h:81
2D vector class.
Definition SbLinear.h:246
3D vector class.
Definition SbLinear.h:120
3D viewing volume class.
Definition SbLinear.h:1058
Class for representing a viewport.
Abstract base class for all actions.
Definition SoAction.h:179
Performs a generic traversal of the scene graph.
Abstract base class for camera nodes.
Definition SoCamera.h:96
virtual void scaleHeight(float scaleFactor)=0
Scales the height of the camera.
SoCamera()
Makes this abstract.
SoSFVec3f position
The location of the camera viewpoint.
Definition SoCamera.h:129
SoSFRotation orientation
The orientation of the camera viewpoint, defined as a rotation of the viewing direction from its defa...
Definition SoCamera.h:133
virtual void callback(SoCallbackAction *action)
SbViewportRegion getViewportBounds(const SbViewportRegion &region) const
Returns the viewport region this camera would use to render into the given viewport region,...
SoSFFloat farDistance
Distance from viewpoint to far clipping plane.
Definition SoCamera.h:142
SoSFFloat aspectRatio
The ratio of camera viewing width to height.
Definition SoCamera.h:138
ViewportMapping
What will happen if the camera and.
Definition SoCamera.h:102
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
SoSFFloat focalDistance
The distance from the viewpoint to the point of focus.
Definition SoCamera.h:147
static void initClass()
virtual void rayPick(SoRayPickAction *action)
virtual void jitter(int numPasses, int curPass, const SbViewportRegion &vpReg, SbVec3f &jitterAmount) const
Returns amount to jitter camera in normalized device coordinates (after projection) for anti-aliasing...
void viewAll(SoNode *sceneRoot, const SbViewportRegion &vpRegion, float slack=1.0)
Sets the camera up to view the scene under the given node or defined by the given path.
virtual void GLRender(SoGLRenderAction *action)
These virtual functions implement all of the actions for nodes, Most of the default implementations d...
void viewAll(SoPath *path, const SbViewportRegion &vpRegion, float slack=1.0)
SoSFFloat nearDistance
Distance from viewpoint to view plane.
Definition SoCamera.h:140
virtual ~SoCamera()
SoSFEnum viewportMapping
Defines how to map the rendered image into the current viewport, when the aspect ratio of the camera ...
Definition SoCamera.h:126
virtual void viewBoundingBox(const SbBox3f &box, float aspect, float slack)=0
Subclasses must define this method, which changes the position and clipping planes of a camera to vie...
virtual SbViewVolume getViewVolume(float useAspectRatio=0.0) const =0
Returns a view volume structure, based on the camera's viewing parameters.
void pointAt(const SbVec3f &targetPoint)
Sets the orientation of the camera so that it points toward the given target point while keeping the ...
virtual void handleEvent(SoHandleEventAction *action)
virtual void doAction(SoAction *action)
This method performs the "typical" operation of a node for any action.
Renders a scene graph using OpenGL.
Computes bounding box of a scene.
Allows nodes in a graph to receive input events.
Abstract base class for all database nodes.
Definition SoNode.h:103
Path that points to a list of hierarchical nodes.
Definition SoPath.h:109
Intersects objects with a ray cast into scene.
Field containing an enumerated value.
Definition SoSFEnum.h:93
Field containing a floating-point value.
Definition SoSFFloat.h:77
Field containing a rotation.
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:79