OpenFrames
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpenFrames::View Class Reference

Encapsulates variables needed for a view. More...

#include <View.hpp>

Inheritance diagram for OpenFrames::View:

Public Types

enum  ProjectionType { ORTHOGRAPHIC =0, PERSPECTIVE }
 
enum  ViewFrameType { ABSOLUTE_FRAME =0, RELATIVE_FRAME }
 
enum  ViewRotationType { DIRECT =0, AZEL }
 

Public Member Functions

 View (ReferenceFrame *root, ReferenceFrame *viewFrame, ViewFrameType baseframe=RELATIVE_FRAME)
 
 View (ReferenceFrame *root, ReferenceFrame *viewFrame, ReferenceFrame *lookatFrame, ViewFrameType frameType=RELATIVE_FRAME, ViewRotationType rotationType=AZEL)
 
ProjectionType getProjectionType ()
 
void setPerspective (const double fovy, const double ratio)
 
void getPerspective (double &fovy, double &ratio) const
 
void setOrthographic (const double left, const double right, const double bottom, const double top)
 
void getOrthographic (double &left, double &right, double &bottom, double &top) const
 
osg::Matrixd getProjectionMatrix ()
 
osg::Matrixd getViewMatrix ()
 
void setDefaultViewDistance (double distance)
 
double getDefaultViewDistance () const
 
FollowingTrackballgetTrackball () const
 
void setTrackball (FollowingTrackball *trackball)
 
void resetView ()
 
void saveView ()
 
void restoreView ()
 
void setViewFrame (ReferenceFrame *root, ReferenceFrame *viewFrame, ViewFrameType frameType=RELATIVE_FRAME)
 
void setViewBetweenFrames (ReferenceFrame *root, ReferenceFrame *viewFrame, ReferenceFrame *lookatFrame, ViewFrameType frameType=RELATIVE_FRAME, ViewRotationType rotationType=AZEL)
 
ReferenceFramegetViewRoot ()
 
ReferenceFramegetViewFrame ()
 
ReferenceFramegetLookAtFrame ()
 
ViewFrameType getViewFrameType ()
 
ViewRotationType getViewRotationType ()
 
bool isValid ()
 

Protected Member Functions

void _init ()
 

Protected Attributes

osg::ref_ptr< TransformAccumulator_xform
 
ViewFrameType _frameType
 
osg::ref_ptr< TransformAccumulator_xform_lookat
 
ViewRotationType _rotationType
 
ProjectionType _projType
 
osg::Matrixd _projection
 
double _defaultViewDistance
 
osg::ref_ptr< FollowingTrackball_trackball
 

Detailed Description

Encapsulates variables needed for a view.

This class encapsulates all the variables needed to describe a view of a scene, namely the modelview and projection matrices. The modelview matrix is a combination of the viewed ReferenceFrame's transformation matrix and the user's point of view (controlled using the mouse/keyboard).

Member Enumeration Documentation

◆ ProjectionType

The type of the projection matrix.

◆ ViewFrameType

The base frame when viewing a ReferenceFrame. The camera is assumed to be fixed in this frame when computing its user-controlled transformations.

◆ ViewRotationType

The method used to rotate the view to look at the "to" frame. Since the camera by default looks down the Y-axis, this specifies how the Y-axis is rotated to match the vector that points to the "to" frame.

Member Function Documentation

◆ getOrthographic()

void OpenFrames::View::getOrthographic ( double &  left,
double &  right,
double &  bottom,
double &  top 
) const
inline

Get the parameters for an orthographic projection. Only valid if an ortho projection was previously set.

◆ getPerspective()

void OpenFrames::View::getPerspective ( double &  fovy,
double &  ratio 
) const
inline

Get the parameters for a symmetric perspective view. Only valid if a perspective view has been previously set.

◆ getProjectionMatrix()

osg::Matrixd OpenFrames::View::getProjectionMatrix ( )
inline

Get the projection and view matrices.

◆ getProjectionType()

ProjectionType OpenFrames::View::getProjectionType ( )
inline

Get the projection type

◆ getTrackball()

FollowingTrackball* OpenFrames::View::getTrackball ( ) const
inline

Get or set the trackball manipulator

◆ getViewRoot()

ReferenceFrame* OpenFrames::View::getViewRoot ( )
inline

Get the root/origin frames associated with this View

◆ resetView()

void OpenFrames::View::resetView ( )

Reset the View's home position to the default. NOTE: This overrides any previously saved view.

◆ saveView()

void OpenFrames::View::saveView ( )

Save the current view as the home view NOTE: This is used by RenderRectangle to save/restore a View when switching Views, so it is not safe for end users. Instead, end users should directly call the trackball's get/setTransformation functions (inherited from osgGA::StandardManipulator) and and OpenVRTrackball's get/setRoomToTrackballMatrix functions with custom view parameters.

◆ setDefaultViewDistance()

void OpenFrames::View::setDefaultViewDistance ( double  distance)
inline

Set the Trackball's default view distance. This is applied when the trackball is reset. A default distance <= 0.0 means that the default distance should be auto-computed.

◆ setOrthographic()

void OpenFrames::View::setOrthographic ( const double  left,
const double  right,
const double  bottom,
const double  top 
)
inline

Set an orthographic projection with the given bounds.

◆ setPerspective()

void OpenFrames::View::setPerspective ( const double  fovy,
const double  ratio 
)
inline

Set a symmetric perspective view.

◆ setViewBetweenFrames()

void OpenFrames::View::setViewBetweenFrames ( ReferenceFrame root,
ReferenceFrame viewFrame,
ReferenceFrame lookatFrame,
ViewFrameType  frameType = RELATIVE_FRAME,
ViewRotationType  rotationType = AZEL 
)

View the lookat frame from the point of view of the base frame. Optionally, set the reference frame used when viewing the target frame and the rotation type that should be used to rotate from the target to the lookat frame.

◆ setViewFrame()

void OpenFrames::View::setViewFrame ( ReferenceFrame root,
ReferenceFrame viewFrame,
ViewFrameType  frameType = RELATIVE_FRAME 
)

Set the frame to be viewed and the root frame that it should be viewed with respect to. Generally the root frame should be the root of the ReferenceFrame heirarchy that the viewed frame is part of. Optionally, set the reference frame used when viewing the target frame.

Member Data Documentation

◆ _defaultViewDistance

double OpenFrames::View::_defaultViewDistance
protected

Default distance at which to view the frame.

◆ _projection

osg::Matrixd OpenFrames::View::_projection
protected

The projection matrix.

◆ _projType

ProjectionType OpenFrames::View::_projType
protected

The projection type for this view.

◆ _trackball

osg::ref_ptr<FollowingTrackball> OpenFrames::View::_trackball
protected

The transform for user interactivity.

◆ _xform

osg::ref_ptr<TransformAccumulator> OpenFrames::View::_xform
protected

The transform for the origin ReferenceFrame.

◆ _xform_lookat

osg::ref_ptr<TransformAccumulator> OpenFrames::View::_xform_lookat
protected

The transform for the look-at ReferenceFrame.


The documentation for this class was generated from the following file: