Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SoCamera.h

00001 /**************************************************************************\
00002  *
00003  *  This file is part of the Coin 3D visualization library.
00004  *  Copyright (C) 1998-2002 by Systems in Motion. All rights reserved.
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Lesser General Public License
00008  *  version 2.1 as published by the Free Software Foundation. See the
00009  *  file LICENSE.LGPL at the root directory of the distribution for
00010  *  more details.
00011  *
00012  *  If you want to use Coin for applications not compatible with the
00013  *  LGPL, please contact SIM to acquire a Professional Edition license.
00014  *
00015  *  Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY
00016  *  http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097
00017  *
00018 \**************************************************************************/
00019 
00020 #ifndef COIN_SOCAMERA_H
00021 #define COIN_SOCAMERA_H
00022 
00023 #include <Inventor/nodes/SoSubNode.h>
00024 #include <Inventor/SbViewportRegion.h>
00025 #include <Inventor/SbViewVolume.h>
00026 #include <Inventor/fields/SoSFRotation.h>
00027 #include <Inventor/fields/SoSFEnum.h>
00028 #include <Inventor/fields/SoSFVec3f.h>
00029 #include <Inventor/fields/SoSFFloat.h>
00030 
00031 #include <Inventor/SbVec3f.h>
00032 #include <Inventor/SbBox3f.h>
00033 
00034 #define SO_ASPECT_SQUARE        1.0f
00035 #define SO_ASPECT_VIDEO         (4.0f/3.0f)
00036 #define SO_ASPECT_35mm_ACADEMY  1.371
00037 #define SO_ASPECT_16mm          1.369
00038 #define SO_ASPECT_35mm_FULL     1.33333
00039 #define SO_ASPECT_70mm          2.287
00040 #define SO_ASPECT_CINEMASCOPE   2.35
00041 #define SO_ASPECT_HDTV          (16.0f/9.0f)
00042 #define SO_ASPECT_PANAVISION    2.361
00043 #define SO_ASPECT_35mm          (3.0f/2.0f)
00044 #define SO_ASPECT_VISTAVISION   2.301
00045 
00046 class SoPath;
00047 
00048 
00049 class COIN_DLL_API SoCamera : public SoNode {
00050   typedef SoNode inherited;
00051 
00052   SO_NODE_ABSTRACT_HEADER(SoCamera);
00053 
00054 public:
00055   static void initClass(void);
00056 
00057   enum ViewportMapping {
00058     CROP_VIEWPORT_FILL_FRAME,
00059     CROP_VIEWPORT_LINE_FRAME,
00060     CROP_VIEWPORT_NO_FRAME,
00061     ADJUST_CAMERA,
00062     LEAVE_ALONE
00063   };
00064 
00065   SoSFEnum viewportMapping;
00066   SoSFVec3f position;
00067   SoSFRotation orientation;
00068   SoSFFloat aspectRatio;
00069   SoSFFloat nearDistance;
00070   SoSFFloat farDistance;
00071   SoSFFloat focalDistance;
00072 
00073   void pointAt(const SbVec3f & targetpoint);
00074   void pointAt(const SbVec3f & targetpoint, const SbVec3f & upvector);
00075   virtual void scaleHeight(float scalefactor) = 0;
00076   virtual SbViewVolume getViewVolume(float useaspectratio = 0.0f) const = 0;
00077   void viewAll(SoNode * const sceneroot, const SbViewportRegion & vpregion,
00078                const float slack = 1.0f);
00079   void viewAll(SoPath * const path, const SbViewportRegion & vpregion,
00080                const float slack = 1.0f);
00081   SbViewportRegion getViewportBounds(const SbViewportRegion & region) const;
00082 
00083   enum StereoMode {
00084     MONOSCOPIC,
00085     LEFT_VIEW,
00086     RIGHT_VIEW
00087   };
00088 
00089   void setStereoMode(StereoMode mode);
00090   StereoMode getStereoMode(void) const;
00091 
00092   void setStereoAdjustment(float adjustment);
00093   float getStereoAdjustment(void) const;
00094   void setBalanceAdjustment(float adjustment);
00095   float getBalanceAdjustment(void) const;
00096 
00097   virtual void doAction(SoAction * action);
00098   virtual void callback(SoCallbackAction * action);
00099   virtual void GLRender(SoGLRenderAction * action);
00100   virtual void getBoundingBox(SoGetBoundingBoxAction * action);
00101   virtual void handleEvent(SoHandleEventAction * action);
00102   virtual void rayPick(SoRayPickAction * action);
00103   virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
00104 
00105 protected:
00106   SoCamera(void);
00107   virtual ~SoCamera();
00108 
00109   virtual void viewBoundingBox(const SbBox3f & box, float aspect,
00110                                float slack) = 0;
00111   virtual void jitter(int numpasses, int curpass,
00112                       const SbViewportRegion & vpreg,
00113                       SbVec3f & jitteramount) const;
00114 
00115 private:
00116   void getView(SoAction * action, SbViewVolume & resultvv,
00117                SbViewportRegion & resultvp,
00118                const SbBool considermodelmatrix = TRUE);
00119 
00120   void drawCroppedFrame(SoGLRenderAction * action,
00121                         const int viewportmapping,
00122                         const SbViewportRegion & oldvp,
00123                         const SbViewportRegion & newvp);
00124 
00125   void lookAt(const SbVec3f & dir, const SbVec3f & up);
00126 
00127   StereoMode stereomode;
00128   float stereoadjustment;
00129   float balanceadjustment;
00130 };
00131 
00132 #endif // !COIN_SOCAMERA_H

Generated at Tue Mar 5 03:31:12 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001