FlightGear next
flightgear::CameraGroup Class Reference

#include <CameraGroup.hxx>

Inherits osg::Referenced.

Public Types

typedef std::vector< osg::ref_ptr< CameraInfo > > CameraList
 

Public Member Functions

 CameraGroup (osgViewer::View *viewer)
 Create a camera group associated with an osgViewer::Viewer.
 
virtual ~CameraGroup ()
 
osgViewer::View * getView ()
 Get the camera group's Viewer.
 
CameraInfobuildCamera (SGPropertyNode *cameraNode)
 Create an osg::Camera from a property node and add it to the camera group.
 
void removeCamera (CameraInfo *info)
 Remove a camera from the camera group.
 
void buildSplashCamera (SGPropertyNode *cameraNode, GraphicsWindow *window=0)
 Create a camera from properties that will draw the splash screen and add it to the camera group.
 
void buildGUICamera (SGPropertyNode *cameraNode, GraphicsWindow *window=0)
 Create a camera from properties that will draw the GUI and add it to the camera group.
 
void update (const osg::Vec3d &position, const osg::Quat &orientation)
 Update the view for the camera group.
 
void setCameraParameters (float vfov, float aspectRatio)
 Set the parameters of the viewer's master camera.
 
void setCameraCullMasks (osg::Node::NodeMask nm)
 Set the cull mask on all non-GUI cameras.
 
void setLODScale (float scale)
 Set the LOD scale on all non-GUI cameras.
 
void resized ()
 Update camera properties after a resize event.
 
double getMasterAspectRatio () const
 get aspect ratio of master camera's viewport
 
CameraInfogetGUICamera () const
 
const CameraListgetCameras ()
 

Static Public Member Functions

static void buildDefaultGroup (osgViewer::View *view)
 Set the default CameraGroup, which is the only one that matters at this time.
 
static void setDefault (CameraGroup *group)
 
static CameraGroupgetDefault ()
 Get the default CameraGroup.
 

Protected Member Functions

simgear::compositor::Compositor * buildVRMirrorCompositor (osg::GraphicsContext *gc, osg::Viewport *viewport)
 Create a compositor for a VR mirror.
 

Static Protected Member Functions

static CameraGroupbuildCameraGroup (osgViewer::View *viewer, SGPropertyNode *node)
 Build a complete CameraGroup from a property node.
 

Protected Attributes

friend CameraGroupListener
 
CameraList _cameras
 
osg::ref_ptr< osgViewer::View > _viewer
 
std::unique_ptr< CameraGroupListener_listener
 
float _zNear
 
float _zFar
 
float _nearField
 

Static Protected Attributes

static osg::ref_ptr< CameraGroup_defaultGroup
 

Friends

bool computeIntersections (const CameraGroup *cgroup, const osg::Vec2d &windowPos, osgUtil::LineSegmentIntersector::Intersections &intersections)
 Choose a camera using an event and do intersection testing on its view of the scene.
 
void reloadCompositors (CameraGroup *cgroup)
 Force a reload of all Compositor instances in the CameraGroup, except the one used by the GUI camera.
 

Detailed Description

Definition at line 136 of file CameraGroup.hxx.

Member Typedef Documentation

◆ CameraList

typedef std::vector<osg::ref_ptr<CameraInfo> > flightgear::CameraGroup::CameraList

Definition at line 221 of file CameraGroup.hxx.

Constructor & Destructor Documentation

◆ CameraGroup()

flightgear::CameraGroup::CameraGroup ( osgViewer::View * viewer)

Create a camera group associated with an osgViewer::Viewer.

Parameters
viewerthe viewer

Definition at line 185 of file CameraGroup.cxx.

◆ ~CameraGroup()

flightgear::CameraGroup::~CameraGroup ( )
virtual

Definition at line 190 of file CameraGroup.cxx.

Member Function Documentation

◆ buildCamera()

CameraInfo * flightgear::CameraGroup::buildCamera ( SGPropertyNode * cameraNode)

Create an osg::Camera from a property node and add it to the camera group.

Parameters
cameraNodethe property node.
Returns
a CameraInfo object for the camera.

Definition at line 287 of file CameraGroup.cxx.

◆ buildCameraGroup()

CameraGroup * flightgear::CameraGroup::buildCameraGroup ( osgViewer::View * viewer,
SGPropertyNode * node )
staticprotected

Build a complete CameraGroup from a property node.

Parameters
viewerthe viewer associated with this camera group.
wbuilderthe window builder to be used for this camera group.
thecamera group property node.

Definition at line 778 of file CameraGroup.cxx.

◆ buildDefaultGroup()

void flightgear::CameraGroup::buildDefaultGroup ( osgViewer::View * view)
static

Set the default CameraGroup, which is the only one that matters at this time.

Parameters
groupthe group to set.

Definition at line 1004 of file CameraGroup.cxx.

◆ buildGUICamera()

void flightgear::CameraGroup::buildGUICamera ( SGPropertyNode * cameraNode,
GraphicsWindow * window = 0 )

Create a camera from properties that will draw the GUI and add it to the camera group.

Parameters
cameraNodethe property node. This can be 0, in which case a default GUI camera is created.
windowthe GraphicsWindow to use for the GUI camera. If this is 0, the window is determined from the property node.
Returns
a CameraInfo object for the GUI camera.

Definition at line 641 of file CameraGroup.cxx.

◆ buildSplashCamera()

void flightgear::CameraGroup::buildSplashCamera ( SGPropertyNode * cameraNode,
GraphicsWindow * window = 0 )

Create a camera from properties that will draw the splash screen and add it to the camera group.

Parameters
cameraNodethe property node. This can be 0, in which case a default GUI camera is created.
windowthe GraphicsWindow to use for the splash camera. If this is 0, the window is determined from the property node.
Returns
a CameraInfo object for the GUI camera.

Definition at line 569 of file CameraGroup.cxx.

◆ buildVRMirrorCompositor()

Compositor * flightgear::CameraGroup::buildVRMirrorCompositor ( osg::GraphicsContext * gc,
osg::Viewport * viewport )
protected

Create a compositor for a VR mirror.

Parameters
gcthe graphics context to use.
viewportthe viewport to render to.
Returns
a new compositor or nullptr if no VR mirror is needed.

Definition at line 727 of file CameraGroup.cxx.

◆ getCameras()

const CameraGroup::CameraList & flightgear::CameraGroup::getCameras ( )

Definition at line 841 of file CameraGroup.cxx.

◆ getDefault()

static CameraGroup * flightgear::CameraGroup::getDefault ( )
inlinestatic

Get the default CameraGroup.

Returns
the default camera group.

Definition at line 154 of file CameraGroup.hxx.

◆ getGUICamera()

CameraInfo * flightgear::CameraGroup::getGUICamera ( ) const

Definition at line 825 of file CameraGroup.cxx.

◆ getMasterAspectRatio()

double flightgear::CameraGroup::getMasterAspectRatio ( ) const

get aspect ratio of master camera's viewport

Definition at line 272 of file CameraGroup.cxx.

◆ getView()

osgViewer::View * flightgear::CameraGroup::getView ( )
inline

Get the camera group's Viewer.

Returns
the viewer

Definition at line 158 of file CameraGroup.hxx.

◆ removeCamera()

void flightgear::CameraGroup::removeCamera ( CameraInfo * info)

Remove a camera from the camera group.

Parameters
infothe camera info to remove.

Definition at line 559 of file CameraGroup.cxx.

◆ resized()

void flightgear::CameraGroup::resized ( )

Update camera properties after a resize event.

Definition at line 819 of file CameraGroup.cxx.

◆ setCameraCullMasks()

void flightgear::CameraGroup::setCameraCullMasks ( osg::Node::NodeMask nm)

Set the cull mask on all non-GUI cameras.

Definition at line 801 of file CameraGroup.cxx.

◆ setCameraParameters()

void flightgear::CameraGroup::setCameraParameters ( float vfov,
float aspectRatio )

Set the parameters of the viewer's master camera.

This won't affect cameras that have CameraFlags::PROJECTION_ABSOLUTE set. XXX Should znear and zfar be settable?

Parameters
vfovthe vertical field of view angle
aspectRatiothe master camera's aspect ratio. This doesn't actually change the viewport, but should reflect the current viewport.

Definition at line 262 of file CameraGroup.cxx.

◆ setDefault()

static void flightgear::CameraGroup::setDefault ( CameraGroup * group)
inlinestatic

Definition at line 150 of file CameraGroup.hxx.

◆ setLODScale()

void flightgear::CameraGroup::setLODScale ( float scale)

Set the LOD scale on all non-GUI cameras.

Definition at line 810 of file CameraGroup.cxx.

◆ update()

void flightgear::CameraGroup::update ( const osg::Vec3d & position,
const osg::Quat & orientation )

Update the view for the camera group.

Parameters
positionthe world position of the view
orientationthe world orientation of the view.

Definition at line 195 of file CameraGroup.cxx.

Friends And Related Symbol Documentation

◆ computeIntersections

bool computeIntersections ( const CameraGroup * cgroup,
const osg::Vec2d & windowPos,
osgUtil::LineSegmentIntersector::Intersections & intersections )
friend

Choose a camera using an event and do intersection testing on its view of the scene.

Only cameras with the DO_INTERSECTION_TEST flag set are considered.

Parameters
cgroupthe CameraGroup
eathe event containing a window and mouse coordinates
intersectionscontainer for the result of intersection testing.
Returns
true if any intersections are found

Definition at line 891 of file CameraGroup.cxx.

◆ reloadCompositors

void reloadCompositors ( CameraGroup * cgroup)
friend

Force a reload of all Compositor instances in the CameraGroup, except the one used by the GUI camera.

Definition at line 949 of file CameraGroup.cxx.

Member Data Documentation

◆ _cameras

CameraList flightgear::CameraGroup::_cameras
protected

Definition at line 232 of file CameraGroup.hxx.

◆ _defaultGroup

osg::ref_ptr< CameraGroup > flightgear::CameraGroup::_defaultGroup
staticprotected

Definition at line 234 of file CameraGroup.hxx.

◆ _listener

std::unique_ptr<CameraGroupListener> flightgear::CameraGroup::_listener
protected

Definition at line 235 of file CameraGroup.hxx.

◆ _nearField

float flightgear::CameraGroup::_nearField
protected

Definition at line 240 of file CameraGroup.hxx.

◆ _viewer

osg::ref_ptr<osgViewer::View> flightgear::CameraGroup::_viewer
protected

Definition at line 233 of file CameraGroup.hxx.

◆ _zFar

float flightgear::CameraGroup::_zFar
protected

Definition at line 239 of file CameraGroup.hxx.

◆ _zNear

float flightgear::CameraGroup::_zNear
protected

Definition at line 238 of file CameraGroup.hxx.

◆ CameraGroupListener

friend flightgear::CameraGroup::CameraGroupListener
protected

Definition at line 225 of file CameraGroup.hxx.


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