gramods
Public Member Functions | Static Public Attributes | Protected Attributes | List of all members
gramods::gmGraphics::Viewpoint Class Reference

The viewpoint represents a point in space from which the view is to be rendered, and an orientation. More...

#include <Viewpoint.hh>

Inheritance diagram for gramods::gmGraphics::Viewpoint:
Inheritance graph
[legend]
Collaboration diagram for gramods::gmGraphics::Viewpoint:
Collaboration graph
[legend]

Public Member Functions

virtual Eigen::Vector3f getPosition (Eye eye=Eye::MONO)
 Returns the position of the viewpoint. More...
 
virtual Eigen::Quaternionf getOrientation (Eye eye=Eye::MONO)
 Returns the orientation of the viewpoint. More...
 
virtual void setPosition (Eigen::Vector3f p)
 Explicitly sets the position of the Viewpoint. More...
 
void setEyeSeparation (float e)
 Sets the distance between the eyes for stereoscopic (or multiscopic) rendering, in internal units, typically meters. More...
 
virtual void setOrientation (Eigen::Quaternionf q)
 Explicitly sets the orientation of the Viewpoint. More...
 
virtual void setUpDirection (Eigen::Vector3f up)
 Set the up direction to be used in a later call to setLookAt. More...
 
virtual void setLookAt (Eigen::Vector3f p)
 Sets a point that the viewpoint should be rotated towards. More...
 
virtual void unsetLookAt ()
 Unsets the look-at point so that the viewpoint orientation is no longer automatically rotated. More...
 
virtual std::string getDefaultKey () override
 Returns the default key, in Configuration, for the Object. More...
 
- Public Member Functions inherited from gramods::gmCore::Object
 Object ()
 Initializes internal data. More...
 
virtual ~Object ()
 Cleaning up internal data. More...
 
virtual void initialize ()
 Called to initialize the Object. More...
 
virtual void accept (Visitor *visitor)
 Calls the visitors apply method with this as argument. More...
 
virtual void traverse (Visitor *visitor)
 Calls the child Object's accept method, if such exist. More...
 
bool isInitialized ()
 Returns true if the Object is initialized. More...
 

Static Public Attributes

static gramods::gmCore::OFactory::OFactoryInformation _gm_ofi
 

Protected Attributes

Eigen::Vector3f position = Eigen::Vector3f::Zero()
 
Eigen::Quaternionf orientation = Eigen::Quaternionf::Identity()
 
Eigen::Vector3f up_direction = Eigen::Vector3f(0, 1, 0)
 
std::optional< Eigen::Vector3f > look_at
 
float eye_separation = 0.06f
 

Detailed Description

The viewpoint represents a point in space from which the view is to be rendered, and an orientation.

The orientation may be used for view orientation or for eye separation. The view may use this Viewpoint to create Camera fitting for rendering.

Sub classes may implement dynamically updated Viewpoints, based on animation or tracking data.

Member Function Documentation

◆ getDefaultKey()

virtual std::string gramods::gmGraphics::Viewpoint::getDefaultKey ( )
inlineoverridevirtual

Returns the default key, in Configuration, for the Object.

Reimplemented from gramods::gmCore::Object.

◆ getOrientation()

Eigen::Quaternionf gramods::gmGraphics::Viewpoint::getOrientation ( Eye  eye = Eye::MONO)
virtual

Returns the orientation of the viewpoint.

Observe that a view may ignore the orientation value if this does not make any difference for its appearance.

Parameters
[in]eyeThe eye for which to fetch orientation. Default is Eye::MONO.

Reimplemented in gramods::gmGraphics::TrackedViewpoint.

◆ getPosition()

Eigen::Vector3f gramods::gmGraphics::Viewpoint::getPosition ( Eye  eye = Eye::MONO)
virtual

Returns the position of the viewpoint.

Parameters
[in]eyeThe eye for which to fetch position. Default is Eye::MONO.

Reimplemented in gramods::gmGraphics::TrackedViewpoint.

◆ setEyeSeparation()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_Viewpoint_param_eyeSeparation &Viewpoint::_gm_ofi(& gramods::gmGraphics::Viewpoint::setEyeSeparation ( float  e)
inline

Sets the distance between the eyes for stereoscopic (or multiscopic) rendering, in internal units, typically meters.

Default is 0.06 m.

XML-attribute: eyeSeparation

◆ setLookAt()

gramods::gmCore::OFactory::ParamSetterInsert gm_ofi_Viewpoint_param_lookAt &Viewpoint::_gm_ofi(& gramods::gmGraphics::Viewpoint::setLookAt ( Eigen::Vector3f  p)
inlinevirtual

Sets a point that the viewpoint should be rotated towards.

Observe that this affects only the viewpoint orientation - camera orientation will not automatically toe-in to this point.

XML-attribute: lookAt

See also
gramods::operator>>(std::istream &, Eigen::Vector3f &)
unsetLookat()

◆ setOrientation()

void gramods::gmGraphics::Viewpoint::setOrientation ( Eigen::Quaternionf  q)
virtual

Explicitly sets the orientation of the Viewpoint.

This may be ignored or instantaneously overwritten by dynamic updates of the position value.

XML-attribute: orientation

See also
gramods::operator>>(std::istream &, Eigen::Quaternionf &)

◆ setPosition()

void gramods::gmGraphics::Viewpoint::setPosition ( Eigen::Vector3f  p)
virtual

Explicitly sets the position of the Viewpoint.

This may be ignored or instantaneously overwritten by dynamic updates of the position value.

XML-attribute: position

See also
gramods::operator>>(std::istream &, Eigen::Vector3f &)

◆ setUpDirection()

void gramods::gmGraphics::Viewpoint::setUpDirection ( Eigen::Vector3f  up)
virtual

Set the up direction to be used in a later call to setLookAt.

This does nothing if setLookAt is not used.

XML-attribute: upDirection

See also
gramods::operator>>(std::istream &, Eigen::Vector3f &)

◆ unsetLookAt()

virtual void gramods::gmGraphics::Viewpoint::unsetLookAt ( )
inlinevirtual

Unsets the look-at point so that the viewpoint orientation is no longer automatically rotated.


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