1SoCamera(3IV)() SoCamera(3IV)()
2
3
4
6 SoCamera — abstract base class for camera nodes
7
9 SoBase > SoFieldContainer > SoNode > SoCamera
10
12 #include <Inventor/nodes/SoCamera.h>
13
14 #define SO_ASPECT_SQUARE 1.00
15 #define SO_ASPECT_VIDEO 1.333333333
16 #define SO_ASPECT_35mm_ACADEMY 1.371
17 #define SO_ASPECT_16mm 1.369
18 #define SO_ASPECT_35mm_FULL 1.33333
19 #define SO_ASPECT_70mm 2.287
20 #define SO_ASPECT_CINEMASCOPE 2.35
21 #define SO_ASPECT_HDTV 1.777777777
22 #define SO_ASPECT_PANAVISION 2.361
23 #define SO_ASPECT_35mm 1.5
24 #define SO_ASPECT_VISTAVISION 2.301
25
26 enum ViewportMapping {
27 SoCamera::CROP_VIEWPORT_FILL_FRAME
28 Crops the viewport within the current win‐
29 dow, so that the aspect ratio matches
30 that of the camera. As the window size
31 changes, the aspect ratio remains
32 unchanged. The cropped region is drawn
33 as a filled gray area.
34 SoCamera::CROP_VIEWPORT_LINE_FRAME
35 Crops the viewport, but draws a thin frame
36 around the viewport
37 SoCamera::CROP_VIEWPORT_NO_FRAME
38 Crops the viewport, but gives no visual
39 feedback as to the viewport dimensions
40 within the window
41 SoCamera::ADJUST_CAMERA Adjusts the camera aspect ratio and height
42 to make it fit within the given win‐
43 dow. (The camera's fields are not
44 affected, just the values sent to the
45 graphics library.)
46 SoCamera::LEAVE_ALONE Do nothing. Camera image may become
47 stretched out of proportion
48 }
49
50 Fields from class SoCamera:
51
52 SoSFEnum viewportMapping
53 SoSFVec3f position
54 SoSFRotation orientation
55 SoSFFloat aspectRatio
56 SoSFFloat nearDistance
57 SoSFFloat farDistance
58 SoSFFloat focalDistance
59
60 Methods from class SoCamera:
61
62 void pointAt(const SbVec3f &targetPoint)
63 virtual void scaleHeight(float scaleFactor)
64 virtual SbViewVolume getViewVolume(float useAspectRatio = 0.0) const
65 void viewAll(SoNode *sceneRoot, const SbViewportRegion
66 &vpRegion, float slack = 1.0)
67 void viewAll(SoPath *path, const SbViewportRegion &vpRe‐
68 gion, float slack = 1.0)
69 SbViewportRegion getViewportBounds(const SbViewportRegion ®ion)
70 const
71 static SoType getClassTypeId()
72
73 Methods from class SoNode:
74
75 void setOverride(SbBool state)
76 SbBool isOverride() const
77 SoNode * copy(SbBool copyConnections = FALSE) const
78 virtual SbBool affectsState() const
79 static SoNode * getByName(const SbName &name)
80 static int getByName(const SbName &name, SoNodeList &list)
81
82 Methods from class SoFieldContainer:
83
84 void setToDefaults()
85 SbBool hasDefaultValues() const
86 SbBool fieldsAreEqual(const SoFieldContainer *fc) const
87 void copyFieldValues(const SoFieldContainer *fc, SbBool
88 copyConnections = FALSE)
89 SbBool set(const char *fieldDataString)
90 void get(SbString &fieldDataString)
91 virtual int getFields(SoFieldList &resultList) const
92 virtual SoField * getField(const SbName &fieldName) const
93 SbBool getFieldName(const SoField *field, SbName &fieldName)
94 const
95 SbBool isNotifyEnabled() const
96 SbBool enableNotify(SbBool flag)
97
98 Methods from class SoBase:
99
100 void ref()
101 void unref() const
102 void unrefNoDelete() const
103 void touch()
104 virtual SoType getTypeId() const
105 SbBool isOfType(SoType type) const
106 virtual void setName(const SbName &name)
107 virtual SbName getName() const
108
109
111 This is the abstract base class for all camera nodes. It defines the
112 common methods and fields that all cameras have. Cameras are used to
113 view a scene. When a camera is encountered during rendering, it sets
114 the projection and viewing matrices and viewport appropriately; it does
115 not draw geometry. Cameras should be placed before any shape nodes or
116 light nodes in a scene graph; otherwise, those shapes or lights cannot
117 be rendered properly. Cameras are affected by the current transforma‐
118 tion, so you can position a camera by placing a transformation node
119 before it in the scene graph . The default position and orientation of
120 a camera is at (0,0,1) looking along the negative z-axis.
121
122 You can also use a node kit to create a camera; see the reference page
123 for SoCameraKit.
124
126 SoSFEnum viewportMapping
127 Defines how to map the rendered image into the current viewport,
128 when the aspect ratio of the camera differs from that of the view‐
129 port.
130
131 SoSFVec3f position
132 The location of the camera viewpoint.
133
134 SoSFRotation orientation
135 The orientation of the camera viewpoint, defined as a rotation of
136 the viewing direction from its default (0,0,-1) vector.
137
138 SoSFFloat aspectRatio
139 The ratio of camera viewing width to height. This value must be
140 greater than 0.0. There are several standard camera aspect ratios
141 defined in SoCamera.h.
142
143 SoSFFloat nearDistance
144 SoSFFloat farDistance
145 The distance from the camera viewpoint to the near and far clipping
146 planes.
147
148 SoSFFloat focalDistance
149 The distance from the viewpoint to the point of focus. This is typi‐
150 cally ignored during rendering, but may be used by some viewers to
151 define a point of interest.
152
153
155 void pointAt(const SbVec3f &targetPoint)
156 Sets the orientation of the camera so that it points toward the
157 given target point while keeping the "up" direction of the camera
158 parallel to the positive y-axis. If this is not possible, it uses
159 the positive z-axis as "up."
160
161 virtual void scaleHeight(float scaleFactor)
162 Scales the height of the camera. Perspective cameras scale their
163 heightAngle fields, and orthographic cameras scale their height
164 fields.
165
166 virtual SbViewVolume getViewVolume(float useAspectRatio = 0.0) const
167 Returns a view volume structure, based on the camera's viewing
168 parameters. If the useAspectRatio argument is not 0.0 (the default),
169 the camera uses that ratio instead of the one it has.
170
171 void viewAll(SoNode *sceneRoot, const SbViewportRegion
172 &vpRegion, float slack = 1.0)
173 void viewAll(SoPath *path, const SbViewportRegion &vpRe‐
174 gion, float slack = 1.0)
175 Sets the camera to view the scene rooted by the given node or
176 defined by the given path. The near and far clipping planes will be
177 positioned slack bounding sphere radii away from the bounding box's
178 center. A value of 1.0 will make the clipping planes the tightest
179 around the bounding sphere.
180
181 SbViewportRegion getViewportBounds(const SbViewportRegion ®ion)
182 const
183 Returns the viewport region this camera would use to render into the
184 given viewport region, accounting for cropping.
185
186 static SoType getClassTypeId()
187 Returns type identifier for this class.
188
189
191 This is an abstract class. See the reference page of a derived class
192 for the format and default values.
193
195 SoOrthographicCamera, SoPerspectiveCamera, SoCameraKit
196
197
198
199
200 SoCamera(3IV)()