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

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

Generated on Fri Aug 2 2013 for Coin by Doxygen. 1.8.4