Open Inventor Release 2023.2.3
 
Loading...
Searching...
No Matches
SoCamera.h
Go to the documentation of this file.
1/*=======================================================================
2 * Copyright 1991-1996, Silicon Graphics, Inc.
3 * ALL RIGHTS RESERVED
4 *
5 * UNPUBLISHED -- Rights reserved under the copyright laws of the United
6 * States. Use of a copyright notice is precautionary only and does not
7 * imply publication or disclosure.
8 *
9 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND:
10 * Use, duplication or disclosure by the Government is subject to restrictions
11 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights
12 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or
13 * in similar or successor clauses in the FAR, or the DOD or NASA FAR
14 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc.,
15 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311.
16 *
17 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY
18 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION,
19 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY
20 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON
21 * GRAPHICS, INC.
22**=======================================================================*/
23/*=======================================================================
24** Author : Paul S. Strauss (MMM yyyy)
25**=======================================================================*/
26/*=======================================================================
27 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
28 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
29 *** ***
30 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
31 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
32 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
33 *** ***
34 *** RESTRICTED RIGHTS LEGEND ***
35 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
36 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
37 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
38 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
39 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
40 *** ***
41 *** COPYRIGHT (C) 1996-2020 BY FEI S.A.S, ***
42 *** BORDEAUX, FRANCE ***
43 *** ALL RIGHTS RESERVED ***
44**=======================================================================*/
45/*=======================================================================
46** Modified by : VSG (MMM YYYY)
47**=======================================================================*/
48
49
50#ifndef _SO_CAMERA_
51#define _SO_CAMERA_
52
53#include <Inventor/SbBox.h>
60#include <Inventor/SbPImpl.h>
61
62#ifdef _WIN32
63#pragma warning(push)
64#pragma warning(disable:4251)
65#endif
66
68class SoState;
69
70
71// Callback function prototypes
72
73class SoCamera ;
74typedef void SoCameraCB( SoCamera *camera, SoGLRenderAction* action );
75
77//
78// Class: SoCamera
79//
80// Abstract base class Camera node.
81//
83
85
86
188class SoCamera : public SoNode {
189
191 SO_PIMPL_PUBLIC_HEADER(SoCamera);
192
193 public:
223
224 // NOTE: These fields are here so that all camera subclasses do
225 // not have to define them separately. However, all subclasses
226 // DO have to set up field data with these fields in them to make
227 // things work properly.
228
229 // Fields
270
276 void pointAt(const SbVec3f &targetPoint);
277
283 virtual void scaleHeight(float scaleFactor) = 0;
284
346 virtual SbViewVolume getViewVolume(float useAspectRatio = 0.0) const = 0;
347
350 float nearDist,
351 float farDist,
353 SbRotation rotation) const = 0;
354
379 void viewAll(SoNode *sceneRoot,
380 const SbViewportRegion &vpRegion,
381 float slack = 1.0);
390 void viewAll(SoPath *path,
391 const SbViewportRegion &vpRegion,
392 float slack = 1.0);
393
401 void viewAll(const SbBox3f& bbox,
402 const SbViewportRegion &vpRegion);
403
409
410#if 1 SoDEPRECATED
418 virtual void setStereoAdjustment(float adjustment);
419SoDEPRECATED
424 float getStereoAdjustment() const;
425
426SoDEPRECATED
468 virtual void setStereoAbsoluteAdjustments( SbBool absolute );
469SoDEPRECATED
475
476SoDEPRECATED
492 virtual void setBalanceAdjustment(float adjustment, SbBool nearFrac = false);
493SoDEPRECATED
498 float getBalanceAdjustment() const;
499
500SoDEPRECATED
507
508SoDEPRECATED
513 virtual void allowStereo(SbBool);
514
515#endif
532
540
545
546private:
547 virtual void doAction(SoAction *action);
548 virtual void callback(SoCallbackAction *action);
549 virtual void GLRender(SoGLRenderAction *action);
550 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
551 virtual void handleEvent(SoHandleEventAction *action);
552 virtual void rayPick(SoRayPickAction *action);
553 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
554
555 private:
556 static void initClass();
557 static void exitClass();
558
559 // Set a callback at the end of SoCamera::GLRender().
560 static void setPostCallback( SoCameraCB *f ) ;
561
562 static SbVec3f fromObjectSpace(const SbVec3f &vector, const SbMatrix &matrix, const SbViewportRegion &vpr);
563 static SbVec3f toObjectSpace(const SbVec3f &pixel, const SbMatrix &matrix, const SbViewportRegion &vpr);
564
567
569 void setLightCamera(bool flag);
570
572 bool isLightCamera() const;
573
577 const SbViewportRegion &getLastViewportRegion() const;
578
580 SbVec3f getFocalPoint() const;
581
582 private:
584 SoCamera();
585
587 virtual ~SoCamera();
588 virtual float getEyeOffset( SoState* state = NULL );
589 virtual void updateStereoAdjustments( SoState* state = NULL );
590
591
598 virtual void viewBoundingBox(const SbBox3f &box, float aspect, float slack) = 0;
599
605 virtual void jitter(int numPasses, int curPass, const SbViewportRegion &vpReg, SbVec3f &jitterAmount) const;
606
607private:
608 void commonConstructor();
609};
610
612//
613// Commonly used camera aspect ratios
614//
615
616#define SO_ASPECT_SQUARE 1.00 /* Square (1.000) */
617#define SO_ASPECT_VIDEO 1.333333333 /* Video (0.75) */
618#define SO_ASPECT_35mm_ACADEMY 1.371 /* 35mm, Academy ap (.72939460) */
619#define SO_ASPECT_16mm 1.369 /* 16mm cinema (.730460189) */
620#define SO_ASPECT_35mm_FULL 1.33333 /* 35mm cinema, full ap (0.75) */
621#define SO_ASPECT_70mm 2.287 /* 70 mm unsqueezed (.43725404) */
622#define SO_ASPECT_CINEMASCOPE 2.35 /* Cinemascope (.425531914) */
623#define SO_ASPECT_HDTV 1.777777777 /* HDTV (16:9) */
624#define SO_ASPECT_PANAVISION 2.361 /* Panavision (.423549343) */
625#define SO_ASPECT_35mm 1.5 /* 35mm still camera (.666666) */
626#define SO_ASPECT_VISTAVISION 2.301 /* Vistavision (.434593654) */
627
628
629#ifdef _WIN32
630#pragma warning(pop)
631#endif
632
633#endif /* _SO_CAMERA_ */
634
void SoCameraCB(SoCamera *camera, SoGLRenderAction *action)
Definition SoCamera.h:74
SO_PIMPL_PUBLIC_DECLARATION(SoFileDataAdapter)
#define SO_NODE_ABSTRACT_HEADER(className)
Definition SoSubNode.h:118
3D box class.
Definition SbBox.h:649
4x4 matrix class.
Definition SbMatrix.h:309
Class for representing a rotation.
Definition SbRotation.h:126
3D vector class.
Definition SbVec.h:932
3D viewing volume class.
Class for representing a viewport.
Abstract base class for all actions.
Definition SoAction.h:132
Performs a generic traversal of a scene graph or path.
Abstract base class for camera nodes.
Definition SoCamera.h:188
virtual void scaleHeight(float scaleFactor)=0
Scales the height of the camera.
SoSFVec3f position
The location of the camera viewpoint.
Definition SoCamera.h:240
virtual SoDEPRECATED void allowStereo(SbBool)
Allows the camera to render in stereo.
SoSFRotation orientation
The orientation of the camera viewpoint, defined as a rotation of the viewing direction from its defa...
Definition SoCamera.h:246
void setStereoMode(StereoMode mode)
Sets the stereo mode.
SbViewportRegion getViewportBounds(const SbViewportRegion &region) const
Returns the viewport region this camera would use to render into the given viewport region,...
SoSFFloat farDistance
The distance from the camera viewpoint to the far clipping plane.
Definition SoCamera.h:262
SoSFFloat aspectRatio
The ratio of camera viewing width to height.
Definition SoCamera.h:252
ViewportMapping
Viewport mapping.
Definition SoCamera.h:195
@ CROP_VIEWPORT_LINE_FRAME
Crops the viewport, but draws a thin frame around the viewport.
Definition SoCamera.h:205
@ CROP_VIEWPORT_NO_FRAME
Crops the viewport, but gives no visual feedback as to the viewport dimensions within the window.
Definition SoCamera.h:210
@ CROP_VIEWPORT_FILL_FRAME
Crops the viewport within the current window, so that the aspect ratio matches that of the camera.
Definition SoCamera.h:201
@ ADJUST_CAMERA
Adjusts the camera aspect ratio and height to make it fit within the given window.
Definition SoCamera.h:217
@ LEAVE_ALONE
Do nothing.
Definition SoCamera.h:221
SoSFFloat focalDistance
The distance from the viewpoint to the point of focus.
Definition SoCamera.h:269
virtual SbViewVolume getViewVolume(float aspectRatio, float nearDist, float farDist, SbVec3f position, SbRotation rotation) const =0
Computes a view volume from the given parameters.
virtual SoDEPRECATED void setStereoAbsoluteAdjustments(SbBool absolute)
Specifies if stereo adjustments are absolute.
void viewAll(const SbBox3f &bbox, const SbViewportRegion &vpRegion)
Sets the camera to view the region defined by the given bounding box.
virtual SoDEPRECATED void setStereoAdjustment(float adjustment)
Sets the stereo offset (the distance of each eye from the camera position).
virtual SoDEPRECATED void setBalanceAdjustment(float adjustment, SbBool nearFrac=false)
Sets the stereo balance (the position of the zero parallax plane) and specifies whether the balance v...
void viewAll(SoNode *sceneRoot, const SbViewportRegion &vpRegion, float slack=1.0)
Sets the camera to view the scene rooted by the given node.
void viewAll(SoPath *path, const SbViewportRegion &vpRegion, float slack=1.0)
Sets the camera to view the scene defined by the given path.
SoSFFloat nearDistance
The distance from the camera viewpoint to the near clipping plane.
Definition SoCamera.h:257
SoDEPRECATED SbBool isBalanceAdjustmentNearFrac() const
Returns TRUE if the stereo balance adjustement is defined as a fraction of the camera near distance.
SoDEPRECATED SbBool getStereoAbsoluteAdjustment() const
Queries the stereo absolute adjustment state.
SoSFEnum viewportMapping
Defines how to map the rendered image into the current viewport, when the aspect ratio of the camera ...
Definition SoCamera.h:235
SoDEPRECATED float getBalanceAdjustment() const
Queries the parallax balance.
SoDEPRECATED float getStereoAdjustment() const
Queries the stereo offset.
virtual SbViewVolume getViewVolume(float useAspectRatio=0.0) const =0
Returns a view volume object, based on the camera's viewing parameters.
StereoMode
Stereo mode.
Definition SoCamera.h:518
@ MONOSCOPIC
Monoscopic (i.e., non-stereo) viewing.
Definition SoCamera.h:522
@ LEFT_VIEW
Left eye view.
Definition SoCamera.h:526
@ RIGHT_VIEW
Right eye view.
Definition SoCamera.h:530
StereoMode getStereoMode() const
Queries the stereo mode.
void pointAt(const SbVec3f &targetPoint)
Sets the orientation of the camera so that it points toward the given target point while keeping the ...
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Counts number of...
Allows nodes in a graph to receive input events.
Abstract base class for all database nodes.
Definition SoNode.h:145
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Intersects objects with a ray cast into scene.
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a rotation.
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87