Coin Logo http://www.sim.no
http://www.coin3d.org

SoCamera.h
1 #ifndef COIN_SOCAMERA_H
2 #define COIN_SOCAMERA_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/nodes/SoSubNode.h>
28 #include <Inventor/SbViewportRegion.h>
29 #include <Inventor/SbViewVolume.h>
30 #include <Inventor/fields/SoSFRotation.h>
31 #include <Inventor/fields/SoSFEnum.h>
32 #include <Inventor/fields/SoSFVec3f.h>
33 #include <Inventor/fields/SoSFFloat.h>
34 
35 #include <Inventor/SbVec3f.h>
36 #include <Inventor/SbBox3f.h>
37 
38 #define SO_ASPECT_SQUARE 1.0f
39 #define SO_ASPECT_VIDEO (4.0f/3.0f)
40 #define SO_ASPECT_35mm_ACADEMY 1.371
41 #define SO_ASPECT_16mm 1.369
42 #define SO_ASPECT_35mm_FULL 1.33333
43 #define SO_ASPECT_70mm 2.287
44 #define SO_ASPECT_CINEMASCOPE 2.35
45 #define SO_ASPECT_HDTV (16.0f/9.0f)
46 #define SO_ASPECT_PANAVISION 2.361
47 #define SO_ASPECT_35mm (3.0f/2.0f)
48 #define SO_ASPECT_VISTAVISION 2.301
49 
50 class SoPath;
51 
52 class SoCameraP;
53 
54 class COIN_DLL_API SoCamera : public SoNode {
55  typedef SoNode inherited;
56 
57  SO_NODE_ABSTRACT_HEADER(SoCamera);
58 
59 public:
60  static void initClass(void);
61 
63  CROP_VIEWPORT_FILL_FRAME,
64  CROP_VIEWPORT_LINE_FRAME,
65  CROP_VIEWPORT_NO_FRAME,
66  ADJUST_CAMERA,
67  LEAVE_ALONE
68  };
69 
77 
78  void pointAt(const SbVec3f & targetpoint);
79  void pointAt(const SbVec3f & targetpoint, const SbVec3f & upvector);
80  virtual void scaleHeight(float scalefactor) = 0;
81  virtual SbViewVolume getViewVolume(float useaspectratio = 0.0f) const = 0;
82  void viewAll(SoNode * const sceneroot, const SbViewportRegion & vpregion,
83  const float slack = 1.0f);
84  void viewAll(SoPath * const path, const SbViewportRegion & vpregion,
85  const float slack = 1.0f);
86  SbViewportRegion getViewportBounds(const SbViewportRegion & region) const;
87 
88  enum StereoMode {
91  RIGHT_VIEW
92  };
93 
94  void setStereoMode(StereoMode mode);
95  StereoMode getStereoMode(void) const;
96 
97  void setStereoAdjustment(float adjustment);
98  float getStereoAdjustment(void) const;
99  void setBalanceAdjustment(float adjustment);
100  float getBalanceAdjustment(void) const;
101 
102  virtual void doAction(SoAction * action);
103  virtual void callback(SoCallbackAction * action);
104  virtual void GLRender(SoGLRenderAction * action);
105  virtual void audioRender(SoAudioRenderAction *action);
106  virtual void getBoundingBox(SoGetBoundingBoxAction * action);
107  virtual void handleEvent(SoHandleEventAction * action);
108  virtual void rayPick(SoRayPickAction * action);
109  virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
110 
111 protected:
112  SoCamera(void);
113  virtual ~SoCamera();
114 
115  virtual void viewBoundingBox(const SbBox3f & box, float aspect,
116  float slack) = 0;
117  virtual void jitter(int numpasses, int curpass,
118  const SbViewportRegion & vpreg,
119  SbVec3f & jitteramount) const;
120 
121 private:
122  void getView(SoAction * action, SbViewVolume & resultvv,
123  SbViewportRegion & resultvp,
124  const SbBool considermodelmatrix = TRUE);
125 
126  void drawCroppedFrame(SoGLRenderAction * action,
127  const int viewportmapping,
128  const SbViewportRegion & oldvp,
129  const SbViewportRegion & newvp);
130 
131  void lookAt(const SbVec3f & dir, const SbVec3f & up);
132 
133  StereoMode stereomode;
134  float stereoadjustment;
135  float balanceadjustment;
136 private:
137  SoCameraP *pimpl;
138  friend class SoCameraP;
139 };
140 
141 #endif // !COIN_SOCAMERA_H
The SoBase class is the top-level superclass for a number of class-hierarchies.SoBase provides the ba...
Definition: SoBase.h:41
The SoRayPickAction class does ray intersection with scene graphs.For interaction with the scene grap...
Definition: SoRayPickAction.h:40
Definition: SoCamera.h:89
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
Definition: SoNode.cpp:846
SoSFFloat nearDistance
Definition: SoCamera.h:74
ViewportMapping
Definition: SoCamera.h:62
The SoCamera class is the abstract base class for camera definition nodes.To be able to view a scene...
Definition: SoCamera.h:54
The SoSFRotation class is a container for an SbRotation.This field is used where nodes, engines or other field containers needs to store a single rotation definition.
Definition: SoSFRotation.h:31
Definition: SoCamera.h:90
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.This box abstraction class ...
Definition: SbBox3f.h:37
StereoMode
Definition: SoCamera.h:88
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
SoSFRotation orientation
Definition: SoCamera.h:72
The SoSFEnum class is a container for an enum value.This field is used where nodes, engines or other field containers needs to store one particular value out of an enumerated set.
Definition: SoSFEnum.h:31
SoSFFloat aspectRatio
Definition: SoCamera.h:73
SoSFVec3f position
Definition: SoCamera.h:71
SoSFFloat focalDistance
Definition: SoCamera.h:76
virtual void rayPick(SoRayPickAction *action)
Definition: SoNode.cpp:1087
virtual void audioRender(SoAudioRenderAction *action)
Definition: SoNode.cpp:1255
The SoPath class is a container class for traversal path descriptions.SoPath objects contain a list o...
Definition: SoPath.h:43
The SoAudioRenderAction class renders the aural parts of the scene graph.Applying this method at a ro...
Definition: SoAudioRenderAction.h:30
The SoAction class is the base class for all traversal actions.Applying actions is the basic mechanis...
Definition: SoAction.h:67
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:37
SoSFFloat farDistance
Definition: SoCamera.h:75
virtual void doAction(SoAction *action)
Definition: SoNode.cpp:761
The SoHandleEventAction class distributes user events to the scene.This is the action used by the GUI...
Definition: SoHandleEventAction.h:36
The SoGetPrimitiveCountAction class counts the primitives in a scene.Apply this action to a scene if ...
Definition: SoGetPrimitiveCountAction.h:32
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs.If this action is applied to a path or scene graph root, it will calculate the bounding box and the center point of the geometry contained within the scene.
Definition: SoGetBoundingBoxAction.h:34
The SbViewVolume class is a viewing volume in 3D space.This class contains the necessary information ...
Definition: SbViewVolume.h:41
The SoCallbackAction class invokes callbacks at specific nodes.This action has mechanisms for trackin...
Definition: SoCallbackAction.h:70
SoSFEnum viewportMapping
Definition: SoCamera.h:70
The SoSFFloat class is a container for a floating point value.This field is used where nodes...
Definition: SoSFFloat.h:30
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
Definition: SoNode.cpp:817
The SoSFVec3f class is a container for an SbVec3f vector.This field is used where nodes...
Definition: SoSFVec3f.h:31
The SbViewportRegion class is a viewport within a full window.The SbViewportRegion class contains inf...
Definition: SbViewportRegion.h:31
virtual void GLRender(SoGLRenderAction *action)
Definition: SoNode.cpp:904
virtual void callback(SoCallbackAction *action)
Definition: SoNode.cpp:974
virtual void handleEvent(SoHandleEventAction *action)
Definition: SoNode.cpp:1031
The SoGLRenderAction class renders the scene graph with OpenGL calls.Applying this method at a root n...
Definition: SoGLRenderAction.h:39

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Fri Jul 20 2018 for Coin by Doxygen. 1.8.14