SoCamera.h Source File

| http://www.sim.no/ http://www.coin3d.org/

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

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) by Kongsberg Oil & Gas Technologies.
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 Kongsberg Oil & Gas Technologies
18 * about acquiring a Coin Professional Edition License.
19 *
20 * See http://www.coin3d.org/ for more information.
21 *
22 * Kongsberg Oil & Gas Technologies, Bygdoy Alle 5, 0257 Oslo, 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
62 enum ViewportMapping {
63 CROP_VIEWPORT_FILL_FRAME,
64 CROP_VIEWPORT_LINE_FRAME,
65 CROP_VIEWPORT_NO_FRAME,
66 ADJUST_CAMERA,
67 LEAVE_ALONE
68 };
69
70 SoSFEnum viewportMapping;
71 SoSFVec3f position;
72 SoSFRotation orientation;
73 SoSFFloat aspectRatio;
74 SoSFFloat nearDistance;
75 SoSFFloat farDistance;
76 SoSFFloat focalDistance;
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 {
89 MONOSCOPIC,
90 LEFT_VIEW,
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
SoBase
The SoBase class is the top-level superclass for a number of class-hierarchies.SoBase provides the ba...
Definition: SoBase.h:36
SoRayPickAction
The SoRayPickAction class does ray intersection with scene graphs.For interaction with the scene grap...
Definition: SoRayPickAction.h:41
SoCamera::MONOSCOPIC
Definition: SoCamera.h:89
SoNode::getPrimitiveCount
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
Definition: SoNode.cpp:870
SoCamera::nearDistance
SoSFFloat nearDistance
Definition: SoCamera.h:74
SoCamera::ViewportMapping
ViewportMapping
Definition: SoCamera.h:62
SoCamera
The SoCamera class is the abstract base class for camera definition nodes.To be able to view a scene...
Definition: SoCamera.h:54
SoSFRotation
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
SoCamera::LEFT_VIEW
Definition: SoCamera.h:90
SbBox3f
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.This box abstraction class ...
Definition: SbBox3f.h:37
SoCamera::StereoMode
StereoMode
Definition: SoCamera.h:88
SoNode
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:47
SoCamera::orientation
SoSFRotation orientation
Definition: SoCamera.h:72
SoSFEnum
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
SoCamera::aspectRatio
SoSFFloat aspectRatio
Definition: SoCamera.h:73
SoCamera::position
SoSFVec3f position
Definition: SoCamera.h:71
SoCamera::focalDistance
SoSFFloat focalDistance
Definition: SoCamera.h:76
SoNode::rayPick
virtual void rayPick(SoRayPickAction *action)
Definition: SoNode.cpp:1115
SoNode::audioRender
virtual void audioRender(SoAudioRenderAction *action)
Definition: SoNode.cpp:1283
SoPath
The SoPath class is a container class for traversal path descriptions.SoPath objects contain a list o...
Definition: SoPath.h:43
SoAudioRenderAction
The SoAudioRenderAction class renders the aural parts of the scene graph.Applying this method at a ro...
Definition: SoAudioRenderAction.h:33
SoAction
The SoAction class is the base class for all traversal actions.Applying actions is the basic mechanis...
Definition: SoAction.h:68
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.This vector class is used...
Definition: SbVec3f.h:40
SoCamera::farDistance
SoSFFloat farDistance
Definition: SoCamera.h:75
SoNode::doAction
virtual void doAction(SoAction *action)
Definition: SoNode.cpp:785
SoHandleEventAction
The SoHandleEventAction class distributes user events to the scene.This is the action used by the GUI...
Definition: SoHandleEventAction.h:37
SoGetPrimitiveCountAction
The SoGetPrimitiveCountAction class counts the primitives in a scene.Apply this action to a scene if ...
Definition: SoGetPrimitiveCountAction.h:34
SoGetBoundingBoxAction
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:36
SbViewVolume
The SbViewVolume class is a viewing volume in 3D space.This class contains the necessary information ...
Definition: SbViewVolume.h:41
SoCallbackAction
The SoCallbackAction class invokes callbacks at specific nodes.This action has mechanisms for trackin...
Definition: SoCallbackAction.h:71
SoCamera::viewportMapping
SoSFEnum viewportMapping
Definition: SoCamera.h:70
SoSFFloat
The SoSFFloat class is a container for a floating point value.This field is used where nodes...
Definition: SoSFFloat.h:30
SoNode::getBoundingBox
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
Definition: SoNode.cpp:841
SoSFVec3f
The SoSFVec3f class is a container for an SbVec3f vector.This field is used where nodes...
Definition: SoSFVec3f.h:31
SbViewportRegion
The SbViewportRegion class is a viewport within a full window.The SbViewportRegion class contains inf...
Definition: SbViewportRegion.h:31
SoNode::GLRender
virtual void GLRender(SoGLRenderAction *action)
Definition: SoNode.cpp:930
SoNode::callback
virtual void callback(SoCallbackAction *action)
Definition: SoNode.cpp:1002
SoNode::handleEvent
virtual void handleEvent(SoHandleEventAction *action)
Definition: SoNode.cpp:1059
SO_NODE_ABSTRACT_HEADER
#define SO_NODE_ABSTRACT_HEADER(classname)
SoGLRenderAction
The SoGLRenderAction class renders the scene graph with OpenGL calls.Applying this method at a root n...
Definition: SoGLRenderAction.h:41

Copyright © 1998-2010 by Kongsberg Oil & Gas Technologies. All rights reserved.