SoCamera.h
#ifndef COIN_SOCAMERA_H
#define COIN_SOCAMERA_H
/**************************************************************************\
* Copyright (c) Kongsberg Oil & Gas Technologies AS
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\**************************************************************************/
#include <Inventor/nodes/SoSubNode.h>
#include <Inventor/SbViewportRegion.h>
#include <Inventor/SbViewVolume.h>
#include <Inventor/fields/SoSFRotation.h>
#include <Inventor/fields/SoSFEnum.h>
#include <Inventor/fields/SoSFVec3f.h>
#include <Inventor/fields/SoSFFloat.h>
#include <Inventor/SbVec3f.h>
#include <Inventor/SbMatrix.h>
#include <Inventor/SbBox3f.h>
#define SO_ASPECT_SQUARE 1.0f
#define SO_ASPECT_VIDEO (4.0f/3.0f)
#define SO_ASPECT_35mm_ACADEMY 1.371
#define SO_ASPECT_16mm 1.369
#define SO_ASPECT_35mm_FULL 1.33333
#define SO_ASPECT_70mm 2.287
#define SO_ASPECT_CINEMASCOPE 2.35
#define SO_ASPECT_HDTV (16.0f/9.0f)
#define SO_ASPECT_PANAVISION 2.361
#define SO_ASPECT_35mm (3.0f/2.0f)
#define SO_ASPECT_VISTAVISION 2.301
class SoPath;
class SoCameraP;
class COIN_DLL_API SoCamera : public SoNode {
typedef SoNode inherited;
SO_NODE_ABSTRACT_HEADER(SoCamera);
public:
static void initClass(void);
enum ViewportMapping {
CROP_VIEWPORT_FILL_FRAME,
CROP_VIEWPORT_LINE_FRAME,
CROP_VIEWPORT_NO_FRAME,
ADJUST_CAMERA,
LEAVE_ALONE
};
SoSFEnum viewportMapping;
SoSFVec3f position;
SoSFRotation orientation;
SoSFFloat aspectRatio;
SoSFFloat nearDistance;
SoSFFloat farDistance;
SoSFFloat focalDistance;
SbViewVolume getViewVolume(const SbViewportRegion & vp,
SbViewportRegion & resultvp,
const SbMatrix & mm = SbMatrix::identity()) const;
void pointAt(const SbVec3f & targetpoint);
void pointAt(const SbVec3f & targetpoint, const SbVec3f & upvector);
virtual void scaleHeight(float scalefactor) = 0;
virtual SbViewVolume getViewVolume(float useaspectratio = 0.0f) const = 0;
void viewAll(SoNode * const sceneroot, const SbViewportRegion & vpregion,
const float slack = 1.0f);
void viewAll(SoPath * const path, const SbViewportRegion & vpregion,
const float slack = 1.0f);
SbViewportRegion getViewportBounds(const SbViewportRegion & region) const;
enum StereoMode {
MONOSCOPIC,
LEFT_VIEW,
RIGHT_VIEW
};
void setStereoMode(StereoMode mode);
StereoMode getStereoMode(void) const;
void setStereoAdjustment(float adjustment);
float getStereoAdjustment(void) const;
void setBalanceAdjustment(float adjustment);
float getBalanceAdjustment(void) const;
virtual void doAction(SoAction * action);
virtual void callback(SoCallbackAction * action);
virtual void GLRender(SoGLRenderAction * action);
virtual void audioRender(SoAudioRenderAction *action);
virtual void getBoundingBox(SoGetBoundingBoxAction * action);
virtual void getMatrix(SoGetMatrixAction * action);
virtual void handleEvent(SoHandleEventAction * action);
virtual void rayPick(SoRayPickAction * action);
virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
virtual void viewBoundingBox(const SbBox3f & box, float aspect,
float slack) = 0;
protected:
SoCamera(void);
virtual ~SoCamera();
virtual void jitter(int numpasses, int curpass,
const SbViewportRegion & vpreg,
SbVec3f & jitteramount) const;
private:
void getView(SoAction * action, SbViewVolume & resultvv,
SbViewportRegion & resultvp,
const SbBool considermodelmatrix = TRUE);
void drawCroppedFrame(SoGLRenderAction * action,
const int viewportmapping,
const SbViewportRegion & oldvp,
const SbViewportRegion & newvp);
void lookAt(const SbVec3f & dir, const SbVec3f & up);
StereoMode stereomode;
float stereoadjustment;
float balanceadjustment;
private:
SoCameraP *pimpl;
friend class SoCameraP;
};
#endif // !COIN_SOCAMERA_H
SbBox3f
The SbBox3f class is an abstraction for an axis aligned 3 dimensional box.
Definition SbBox3f.h:46
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:47
SbMatrix::identity
static SbMatrix identity(void)
Definition SbMatrix.cpp:848
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
SbViewVolume
The SbViewVolume class is a viewing volume in 3D space.
Definition SbViewVolume.h:50
SbViewportRegion
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
SoAction
The SoAction class is the base class for all traversal actions.
Definition SoAction.h:77
SoAudioRenderAction
The SoAudioRenderAction class renders the aural parts of the scene graph.
Definition SoAudioRenderAction.h:42
SoCallbackAction
The SoCallbackAction class invokes callbacks at specific nodes.
Definition SoCallbackAction.h:80
SoCamera::pointAt
void pointAt(const SbVec3f &targetpoint)
Definition SoCamera.cpp:487
SoCamera::position
SoSFVec3f position
Definition SoCamera.h:81
SoCamera::orientation
SoSFRotation orientation
Definition SoCamera.h:82
SoCamera::getViewportBounds
SbViewportRegion getViewportBounds(const SbViewportRegion &region) const
Definition SoCamera.cpp:627
SoCamera::farDistance
SoSFFloat farDistance
Definition SoCamera.h:85
SoCamera::aspectRatio
SoSFFloat aspectRatio
Definition SoCamera.h:83
SoCamera::ViewportMapping
ViewportMapping
Definition SoCamera.h:72
SoCamera::focalDistance
SoSFFloat focalDistance
Definition SoCamera.h:86
SoCamera::scaleHeight
virtual void scaleHeight(float scalefactor)=0
SoCamera::nearDistance
SoSFFloat nearDistance
Definition SoCamera.h:84
SoCamera::viewportMapping
SoSFEnum viewportMapping
Definition SoCamera.h:80
SoCamera::jitter
virtual void jitter(int numpasses, int curpass, const SbViewportRegion &vpreg, SbVec3f &jitteramount) const
Definition SoCamera.cpp:824
SoCamera::getViewVolume
SbViewVolume getViewVolume(const SbViewportRegion &vp, SbViewportRegion &resultvp, const SbMatrix &mm=SbMatrix::identity()) const
Definition SoCamera.cpp:433
SoCamera::viewBoundingBox
virtual void viewBoundingBox(const SbBox3f &box, float aspect, float slack)=0
SoCamera::StereoMode
StereoMode
Definition SoCamera.h:102
SoCamera::MONOSCOPIC
@ MONOSCOPIC
Definition SoCamera.h:103
SoCamera::LEFT_VIEW
@ LEFT_VIEW
Definition SoCamera.h:104
SoCamera::RIGHT_VIEW
@ RIGHT_VIEW
Definition SoCamera.h:105
SoCamera::getViewVolume
virtual SbViewVolume getViewVolume(float useaspectratio=0.0f) const =0
SoCamera::viewAll
void viewAll(SoNode *const sceneroot, const SbViewportRegion &vpregion, const float slack=1.0f)
Definition SoCamera.cpp:548
SoCamera::SoCamera
SoCamera(void)
Definition SoCamera.cpp:342
SoGLRenderAction
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:50
SoGetBoundingBoxAction
The SoGetBoundingBoxAction class calculates bounding boxes for nodes and subgraphs.
Definition SoGetBoundingBoxAction.h:45
SoGetMatrixAction
The SoGetMatrixAction class is an action for accumulating the transformation matrix of a subgraph.
Definition SoGetMatrixAction.h:46
SoGetPrimitiveCountAction
The SoGetPrimitiveCountAction class counts the primitives in a scene.
Definition SoGetPrimitiveCountAction.h:44
SoHandleEventAction
The SoHandleEventAction class distributes user events to the scene.
Definition SoHandleEventAction.h:46
SoNode::SoNode
SoNode(void)
Definition SoNode.cpp:417
SoNode::getPrimitiveCount
virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action)
Definition SoNode.cpp:943
SoNode::handleEvent
virtual void handleEvent(SoHandleEventAction *action)
Definition SoNode.cpp:1132
SoNode::getBoundingBox
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
Definition SoNode.cpp:914
SoNode::audioRender
virtual void audioRender(SoAudioRenderAction *action)
Definition SoNode.cpp:1356
SoNode::doAction
virtual void doAction(SoAction *action)
Definition SoNode.cpp:858
SoNode::callback
virtual void callback(SoCallbackAction *action)
Definition SoNode.cpp:1075
SoNode::getMatrix
virtual void getMatrix(SoGetMatrixAction *action)
Definition SoNode.cpp:1102
SoNode::rayPick
virtual void rayPick(SoRayPickAction *action)
Definition SoNode.cpp:1188
SoNode::initClass
static void initClass(void)
Sets up initialization for data common to all instances of this class, like submitting necessary info...
Definition SoNode.cpp:573
SoNode::GLRender
virtual void GLRender(SoGLRenderAction *action)
Definition SoNode.cpp:1003
SoPath
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:52
SoRayPickAction
The SoRayPickAction class does ray intersection with scene graphs.
Definition SoRayPickAction.h:50
SoSFEnum
The SoSFEnum class is a container for an enum value.
Definition SoSFEnum.h:40
SoSFFloat
The SoSFFloat class is a container for a floating point value.
Definition SoSFFloat.h:39
SoSFRotation
The SoSFRotation class is a container for an SbRotation.
Definition SoSFRotation.h:40
SoSFVec3f
The SoSFVec3f class is a container for an SbVec3f vector.
Definition SoSFVec3f.h:40
SO_NODE_ABSTRACT_HEADER
#define SO_NODE_ABSTRACT_HEADER(classname)
Definition Coin_macros.dox:61