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) 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
50class SoPath;
51
52class SoCameraP;
53
54class COIN_DLL_API SoCamera : public SoNode {
55 typedef SoNode inherited;
56
58
59public:
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
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
111protected:
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
121private:
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;
136private:
137 SoCameraP *pimpl;
138 friend class SoCameraP;
139};
140
141#endif // !COIN_SOCAMERA_H
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition SbBox3f.h:37
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:40
The SbViewVolume class is a viewing volume in 3D space.
Definition SbViewVolume.h:41
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:31
The SoAction class is the base class for all traversal actions.
Definition SoAction.h:68
The SoAudioRenderAction class renders the aural parts of the scene graph.
Definition SoAudioRenderAction.h:33
The SoCallbackAction class invokes callbacks at specific nodes.
Definition SoCallbackAction.h:71
The SoCamera class is the abstract base class for camera definition nodes.
Definition SoCamera.h:54
SoSFVec3f position
Definition SoCamera.h:71
SoSFRotation orientation
Definition SoCamera.h:72
SoSFFloat farDistance
Definition SoCamera.h:75
SoSFFloat aspectRatio
Definition SoCamera.h:73
ViewportMapping
Definition SoCamera.h:62
SoSFFloat focalDistance
Definition SoCamera.h:76
virtual void scaleHeight(float scalefactor)=0
SoSFFloat nearDistance
Definition SoCamera.h:74
SoSFEnum viewportMapping
Definition SoCamera.h:70
virtual void viewBoundingBox(const SbBox3f &box, float aspect, float slack)=0
StereoMode
Definition SoCamera.h:88
@ MONOSCOPIC
Definition SoCamera.h:89
@ LEFT_VIEW
Definition SoCamera.h:90
virtual SbViewVolume getViewVolume(float useaspectratio=0.0f) const =0
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:41
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs.
Definition SoGetBoundingBoxAction.h:36
The SoGetPrimitiveCountAction class counts the primitives in a scene.
Definition SoGetPrimitiveCountAction.h:34
The SoHandleEventAction class distributes user events to the scene.
Definition SoHandleEventAction.h:37
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:47
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
Definition SoNode.cpp:870
virtual void handleEvent(SoHandleEventAction *action)
Definition SoNode.cpp:1059
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
Definition SoNode.cpp:841
virtual void audioRender(SoAudioRenderAction *action)
Definition SoNode.cpp:1283
virtual void doAction(SoAction *action)
Definition SoNode.cpp:785
virtual void callback(SoCallbackAction *action)
Definition SoNode.cpp:1002
virtual void rayPick(SoRayPickAction *action)
Definition SoNode.cpp:1115
virtual void GLRender(SoGLRenderAction *action)
Definition SoNode.cpp:930
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:43
The SoRayPickAction class does ray intersection with scene graphs.
Definition SoRayPickAction.h:41
The SoSFEnum class is a container for an enum value.
Definition SoSFEnum.h:31
The SoSFFloat class is a container for a floating point value.
Definition SoSFFloat.h:30
The SoSFRotation class is a container for an SbRotation.
Definition SoSFRotation.h:31
The SoSFVec3f class is a container for an SbVec3f vector.
Definition SoSFVec3f.h:31
#define SO_NODE_ABSTRACT_HEADER(classname)
Definition macros.dox:54

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

Generated on Wed Jul 17 2024 for Coin by Doxygen 1.12.0.