VR-Forces 4.1.1 Class Documentation
List of all members | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends
makVrv::DtOsgChannel Class Reference

This class provides the OSG-specific implementation of a DtChannel. More...

Inheritance diagram for makVrv::DtOsgChannel:
Inheritance graph
[legend]

Public Member Functions

virtual ~DtOsgChannel ()
 DTOR.
void setSensorName (const std::string &sensorName)
 Set the name of the sensor to use.
virtual void setClearColor (float r, float g, float b, float a)
 Set the clear color for the channel.
virtual void setWindow (DtWindow *view)
 Set the window the channel is displayed on.
virtual const DtWindowwindow () const
 Get the window the channel is displayed on.
virtual void setViewport (int x, int y, int width, int height)
 Set the viewport.
virtual void getViewport (int &x, int &y, int &width, int &height) const
 Get the viewport.
virtual void setCameraPosition (double x, double y, double z)
 Set the camera position.
virtual void setCameraOrientation (double psi, double theta, double phi)
 Set the camera orientation.
virtual void setCameraPositionAndOrientation (double x, double y, double z, double psi, double theta, double phi)
 Set camera position and orientation.
virtual void setCameraPositionAndOrientation (osg::Vec3d &pos, osg::Quat &orient)
virtual void getCameraPositionAndOrientation (osg::Vec3d &position, osg::Quat &rotation) const
 Get the camera position and orientation.
virtual void update ()
 Update a channel.
virtual void connectToObserver ()
 Set up based on current observer parameters, such as modelSet and is2D.
virtual void setDynamicNearFar (bool enable)
 Set to use dynamic near far planes.
virtual void setNearFarRatio (double ratio)
 Set to the reation of the near and far planes when using dynamic near far planes.
virtual void setProjectionMatrixAsPerspective (double fovy, double aspectRatio, double zNear, double zFar)
 Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details.
virtual void setProjectionMatrixAsFrustum (double left, double right, double bottom, double top, double zNear, double zFar)
 Set to a perspective projection.
virtual osgViewer::View & view ()
 Window accessor.
virtual DtCameraNodesceneCamera ()
 Accessor for the 3D camera.
virtual const DtCameraNodesceneCamera () const
virtual DtCameraNodepostProcessingCamera ()
 Accessor for the 2D overlay camera.
virtual const DtCameraNodepostProcessingCamera () const
 Accessor for the 2D overlay camera.
virtual DtCameraNodeoverlayCamera ()
 Accessor for the 2D overlay camera.
virtual void setPostProcessingEnabled (bool enabled)
 Enable or disable post processing effects on this channel.
virtual void setPostProcessCamera (DtCameraNode *camera)
 Set the camera to use for post processing effects.
virtual void setPostProcessTexture (osg::Texture *texture)
 Set a texture to render this channel onto before post processing.
*virtual void setProjectionResizePolicy (DtChannelConfiguration::ProjectionResizePolicy policy)
 Set the policy used to determine if and how the projection matrix should be adjusted on window resizes.
virtual void updateProjection ()
 This method is called when ever the channel's projection matrix needs to be updated.
void projectionUnitsToFrustum (DtChannelConfiguration::ProjectionUnits units, double &left, double zNear, double &right, double &top, double &bottom)
virtual void connectChannelToScene ()
 Set the channel's scene graph root.
virtual bool processMouseEvent (const DtMouseEvent &ev)
 attempt to handle a mouse event with the channel's overlay
virtual bool processKeyboardEvent (const DtKeyEvent &ev)
 attempt to handle a keyboard event with the channel's overlay
void getWorldToWindowMatrix (osg::Matrix &worldToWindowMatrix) const
 Get the channel's dynamic overlay if any.
virtual void moveMouseToScreenLocation (float screenX, float screenY)
 Move the mouse pointer to the specified location in screen coordinates.
virtual void projectToScreen (double dbX, double dbY, double dbZ, double &screenX, double &screenY, double &screenZ)
 Project a point from world coordinates to screen coordinates.
virtual void projectToWorld (double screenX, double screenY, double &dbX, double &dbY, double &dbZ)
 project the local world coordinates given screen coordinates
virtual const std::string & name ()
 Returns the channel's name as defined in its configuration.
- Public Member Functions inherited from makVrv::DtChannel
virtual ~DtChannel ()
 DTOR.
DtObserverObjectfindObserver () const
 Attempt to get the observer for the channel.
unsigned int currentModelSet () const
 Get the current model set.
const DtChannelConfigurationconfiguration () const
 Get the configuration.
virtual void setObserverName (const std::string &observerName)
 set the name of the observer to use, and attempt to connect
*virtual
DtChannelConfiguration::ProjectionResizePolicy 
projectionResizePolicy () const
 Get the policy used to determine if and how the projection matrix should be adjusted on window resizes.

Public Attributes

boost::signal< void(int, int,
int, int)> 
signal_viewportChanged
 Emitted when the channel's viewport changes dimensions.

Protected Types

typedef std::map< int,
DtChannelSpecificGroup * > 
VisualTypeMap

Protected Member Functions

 DtOsgChannel (DtDe &de, DtOsgWindow *window, DtChannelConfiguration &config)
 Called by Creator object.
virtual void addOverlayDrawablesToCameras ()
 Add drawables to render overlays to their respective cameras.
virtual void initializeStatsHandler ()
 Create an OSG stats handler and add it to the view.
virtual void initializeSignalConnections ()
 Connect channel's slots to signals from other objects.
void makeObserverToCameraMatrix (osg::Vec3d &orient, osg::Matrixd &offsetObserverToCamera)
void makeObserverToCameraMatrix (osg::Quat &qObserverToWorld, osg::Matrixd &offsetObserverToCamera)
virtual void calculateNearFar (double &zNear, double &zFar)
 Calculates near/far depending on visual mode.
virtual void projectFor3D ()
 Projects frustum matrix for 3D viewing.
virtual void projectFor2D ()
 Projects ortho matrix for 2D viewing.
virtual void stopUsingModelSet (int modelSet)
 Stop rendering the specified model set on this channel.
virtual void startUsingModelSet (int modelSet)
 Start rendering the specified model set on this channel.
virtual void stopUsingSensor (DtSensor *sensor)
 Stop applying a sensor to this channel.
virtual void startUsingSensor (DtSensor *sensor)
 Apply a sensor to this channel.
virtual void slot_sensorRemoved (DtSensor *sensor)
 Called when a sensor is removed or deleted by the sensor manager.
virtual void slot_visualizerRootAdded (int modelSet, int visualType)
 called by signal when a new visualizer root is added
virtual void slot_observerModelSetChanged (DtObserverObject *observer, int modelSet)
 Called by signal when an observer's model set changes.
virtual void slot_observerSettingChanged (DtObserverObject *observer, int setting, bool value)
 Called by signal when an observer's visual setting changes.
virtual void slot_observerSettingRemoved (DtObserverObject *observer, int setting)
 Called by signal when an observer's visual setting is removed.
virtual void slot_channelAdded (DtChannelManager *mgr, DtChannel *channel)
 slot to be called when a new channel is added
virtual void slot_channelDestroyed (DtChannelManager *mgr, DtChannel *channel)
 slot to be called when a channel is removed
virtual void slot_windowConfigurationModified (const std::string &deName, const std::string &oldWindowName, const DtWindowConfiguration &config)
 slot to be called when the window configuration changes.
virtual void slot_onCoordinateSystemChanged ()
 receive signals from the shared state about coordinate system changes
virtual void throttleDatabasePager (DtChannelManager *mgr, DtChannel *channel)
 slot to be called when a channel is added or removed.
void stopUsingModelSetWork (int modelSet)
 Stop rendering the specified model set on this channel.
void startUsingModelSetWork (int modelSet)
 Start rendering the specified model set on this channel.
Initialization functions
virtual bool initialize ()
 Initialize the channel.
Create and initialize cameras
virtual void initializeNormalized2DCamera ()
virtual void initialize2DCamera (int w, int h)
virtual void initializeSceneCamera ()
void initializeViewCamera ()
- Protected Member Functions inherited from makVrv::DtChannel
 DtChannel (DtDe &de, DtChannelConfiguration &)
 The constructor for an abstract class is not public.
void observerAdded (const std::string &observerName)
void observerRemoved (const std::string &observerName)

Protected Attributes

osg::ref_ptr< osgViewer::View > myView
DtOsgWindowmyOsgWindow
DtSensormySensor
osg::ref_ptr< osg::Group > myRoot
osg::ref_ptr< DtCameraNodemyPostProcessCamera
osg::ref_ptr< osg::Texture > myPostProcessBuffer
osg::ref_ptr< DtCameraNodemy2DCamera
osg::ref_ptr< DtCameraNodemyNormalized2DCamera
osg::ref_ptr< DtCameraNodemySceneCamera
 The camera rendering the 3d scene.
osg::ref_ptr< DtCameraNodemyViewCamera
 The camera rendering the scene texture onto the channel.
osg::ref_ptr< osg::Texture2D > mySceneTexture
 The texture the 3d scene renders onto, which is then applied to the channel by the view camera.
bool myIsUsingTrackballManipulator
bool myCoordinateSystemChanged
- Protected Attributes inherited from makVrv::DtChannel
DtDemyDe
DtChannelConfigurationmyChannelConfiguration
DtSignalConnectionManager myConnections
int myModelSet
DtObserverObjectmyObserver
std::string myObserverName
DtChannelConfiguration::ProjectionResizePolicy myProjectionResizePolicy

Friends

class DtOsgChannelCreator

Detailed Description

This class provides the OSG-specific implementation of a DtChannel.

Examples

Member Typedef Documentation

typedef std::map< int, DtChannelSpecificGroup*> makVrv::DtOsgChannel::VisualTypeMap
protected

Constructor & Destructor Documentation

makVrv::DtOsgChannel::DtOsgChannel ( DtDe de,
DtOsgWindow window,
DtChannelConfiguration config 
)
protected

Called by Creator object.

Must call initialize() on an instance of this class before using it

virtual makVrv::DtOsgChannel::~DtOsgChannel ( )
virtual

DTOR.

Member Function Documentation

virtual bool makVrv::DtOsgChannel::initialize ( )
protectedvirtual

Initialize the channel.

Must call this on an instance of this class before using it. Returns false if initialization failed.

virtual void makVrv::DtOsgChannel::initializeNormalized2DCamera ( )
protectedvirtual
virtual void makVrv::DtOsgChannel::initialize2DCamera ( int  w,
int  h 
)
protectedvirtual
virtual void makVrv::DtOsgChannel::initializeSceneCamera ( )
protectedvirtual
void makVrv::DtOsgChannel::initializeViewCamera ( )
protected
virtual void makVrv::DtOsgChannel::addOverlayDrawablesToCameras ( )
protectedvirtual

Add drawables to render overlays to their respective cameras.

virtual void makVrv::DtOsgChannel::initializeStatsHandler ( )
protectedvirtual

Create an OSG stats handler and add it to the view.

virtual void makVrv::DtOsgChannel::initializeSignalConnections ( )
protectedvirtual

Connect channel's slots to signals from other objects.

All signal connections are managed by the member signal connection manager and automatically disconnected when this object is deleted

void makVrv::DtOsgChannel::setSensorName ( const std::string &  sensorName)
virtual

Set the name of the sensor to use.

The special name defined by DtChannelManager::UseObserverSensor causes the channel to use the sensor specified by its observer

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setClearColor ( float  r,
float  g,
float  b,
float  a 
)
virtual

Set the clear color for the channel.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setWindow ( DtWindow view)
virtual

Set the window the channel is displayed on.

Exceptions
DtCorruptedStateif the window pointer is NULL or is not a DtOsgView

Implements makVrv::DtChannel.

virtual const DtWindow* makVrv::DtOsgChannel::window ( ) const
virtual

Get the window the channel is displayed on.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setViewport ( int  x,
int  y,
int  width,
int  height 
)
virtual

Set the viewport.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::getViewport ( int &  x,
int &  y,
int &  width,
int &  height 
) const
virtual

Get the viewport.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setCameraPosition ( double  x,
double  y,
double  z 
)
virtual

Set the camera position.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setCameraOrientation ( double  psi,
double  theta,
double  phi 
)
virtual

Set the camera orientation.

virtual void makVrv::DtOsgChannel::setCameraPositionAndOrientation ( double  x,
double  y,
double  z,
double  psi,
double  theta,
double  phi 
)
virtual

Set camera position and orientation.

When you need to set Set camera position and orientation. When you need to set both, this a little more efficient than calling setCameraPosition and setCameraOrientation seperately.

virtual void makVrv::DtOsgChannel::setCameraPositionAndOrientation ( osg::Vec3d &  pos,
osg::Quat &  orient 
)
virtual
virtual void makVrv::DtOsgChannel::getCameraPositionAndOrientation ( osg::Vec3d &  position,
osg::Quat &  rotation 
) const
virtual

Get the camera position and orientation.

virtual void makVrv::DtOsgChannel::update ( )
virtual

Update a channel.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::connectToObserver ( )
virtual

Set up based on current observer parameters, such as modelSet and is2D.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setDynamicNearFar ( bool  enable)
virtual

Set to use dynamic near far planes.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setNearFarRatio ( double  ratio)
virtual

Set to the reation of the near and far planes when using dynamic near far planes.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setProjectionMatrixAsPerspective ( double  fovy,
double  aspectRatio,
double  zNear,
double  zFar 
)
virtual

Create a symmetrical perspective projection, See OpenGL gluPerspective documentation for further details.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::setProjectionMatrixAsFrustum ( double  left,
double  right,
double  bottom,
double  top,
double  zNear,
double  zFar 
)
virtual

Set to a perspective projection.

Implements makVrv::DtChannel.

virtual osgViewer::View& makVrv::DtOsgChannel::view ( )
virtual

Window accessor.

virtual DtCameraNode* makVrv::DtOsgChannel::sceneCamera ( )
virtual

Accessor for the 3D camera.

virtual const DtCameraNode* makVrv::DtOsgChannel::sceneCamera ( ) const
virtual
virtual DtCameraNode* makVrv::DtOsgChannel::postProcessingCamera ( )
virtual

Accessor for the 2D overlay camera.

virtual const DtCameraNode* makVrv::DtOsgChannel::postProcessingCamera ( ) const
virtual

Accessor for the 2D overlay camera.

virtual DtCameraNode* makVrv::DtOsgChannel::overlayCamera ( )
virtual

Accessor for the 2D overlay camera.

virtual void makVrv::DtOsgChannel::setPostProcessingEnabled ( bool  enabled)
virtual

Enable or disable post processing effects on this channel.

virtual void makVrv::DtOsgChannel::setPostProcessCamera ( DtCameraNode camera)
virtual

Set the camera to use for post processing effects.

virtual void makVrv::DtOsgChannel::setPostProcessTexture ( osg::Texture *  texture)
virtual

Set a texture to render this channel onto before post processing.

Use to apply a post-processing effect to the channel

* virtual void makVrv::DtOsgChannel::setProjectionResizePolicy ( DtChannelConfiguration::ProjectionResizePolicy  policy)
virtual

Set the policy used to determine if and how the projection matrix should be adjusted on window resizes.

Reimplemented from makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::updateProjection ( )
virtual

This method is called when ever the channel's projection matrix needs to be updated.

Implements makVrv::DtChannel.

void makVrv::DtOsgChannel::projectionUnitsToFrustum ( DtChannelConfiguration::ProjectionUnits  units,
double &  left,
double  zNear,
double &  right,
double &  top,
double &  bottom 
)
virtual void makVrv::DtOsgChannel::connectChannelToScene ( )
virtual

Set the channel's scene graph root.

virtual bool makVrv::DtOsgChannel::processMouseEvent ( const DtMouseEvent ev)
virtual

attempt to handle a mouse event with the channel's overlay

Implements makVrv::DtChannel.

virtual bool makVrv::DtOsgChannel::processKeyboardEvent ( const DtKeyEvent ev)
virtual

attempt to handle a keyboard event with the channel's overlay

Implements makVrv::DtChannel.

void makVrv::DtOsgChannel::getWorldToWindowMatrix ( osg::Matrix &  worldToWindowMatrix) const

Get the channel's dynamic overlay if any.

Get the camera's world to window matrix

virtual void makVrv::DtOsgChannel::moveMouseToScreenLocation ( float  screenX,
float  screenY 
)
virtual

Move the mouse pointer to the specified location in screen coordinates.

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::projectToScreen ( double  dbX,
double  dbY,
double  dbZ,
double &  screenX,
double &  screenY,
double &  screenZ 
)
virtual

Project a point from world coordinates to screen coordinates.

Returns screen coordinates in screenX, screenY, screenZ

Implements makVrv::DtChannel.

virtual void makVrv::DtOsgChannel::projectToWorld ( double  screenX,
double  screenY,
double &  dbX,
double &  dbY,
double &  dbZ 
)
virtual

project the local world coordinates given screen coordinates

Implements makVrv::DtChannel.

virtual const std::string& makVrv::DtOsgChannel::name ( )
virtual

Returns the channel's name as defined in its configuration.

void makVrv::DtOsgChannel::makeObserverToCameraMatrix ( osg::Vec3d &  orient,
osg::Matrixd &  offsetObserverToCamera 
)
protected
void makVrv::DtOsgChannel::makeObserverToCameraMatrix ( osg::Quat &  qObserverToWorld,
osg::Matrixd &  offsetObserverToCamera 
)
protected
virtual void makVrv::DtOsgChannel::calculateNearFar ( double &  zNear,
double &  zFar 
)
protectedvirtual

Calculates near/far depending on visual mode.

virtual void makVrv::DtOsgChannel::projectFor3D ( )
protectedvirtual

Projects frustum matrix for 3D viewing.

virtual void makVrv::DtOsgChannel::projectFor2D ( )
protectedvirtual

Projects ortho matrix for 2D viewing.

virtual void makVrv::DtOsgChannel::stopUsingModelSet ( int  modelSet)
protectedvirtual

Stop rendering the specified model set on this channel.

Forwards calls to stopUsingModelSetWork

virtual void makVrv::DtOsgChannel::startUsingModelSet ( int  modelSet)
protectedvirtual

Start rendering the specified model set on this channel.

Forwards calls to startUsingModelSetWork

virtual void makVrv::DtOsgChannel::stopUsingSensor ( DtSensor sensor)
protectedvirtual

Stop applying a sensor to this channel.

virtual void makVrv::DtOsgChannel::startUsingSensor ( DtSensor sensor)
protectedvirtual

Apply a sensor to this channel.

virtual void makVrv::DtOsgChannel::slot_sensorRemoved ( DtSensor sensor)
protectedvirtual

Called when a sensor is removed or deleted by the sensor manager.

virtual void makVrv::DtOsgChannel::slot_visualizerRootAdded ( int  modelSet,
int  visualType 
)
protectedvirtual

called by signal when a new visualizer root is added

virtual void makVrv::DtOsgChannel::slot_observerModelSetChanged ( DtObserverObject observer,
int  modelSet 
)
protectedvirtual

Called by signal when an observer's model set changes.

virtual void makVrv::DtOsgChannel::slot_observerSettingChanged ( DtObserverObject observer,
int  setting,
bool  value 
)
protectedvirtual

Called by signal when an observer's visual setting changes.

virtual void makVrv::DtOsgChannel::slot_observerSettingRemoved ( DtObserverObject observer,
int  setting 
)
protectedvirtual

Called by signal when an observer's visual setting is removed.

virtual void makVrv::DtOsgChannel::slot_channelAdded ( DtChannelManager mgr,
DtChannel channel 
)
protectedvirtual

slot to be called when a new channel is added

virtual void makVrv::DtOsgChannel::slot_channelDestroyed ( DtChannelManager mgr,
DtChannel channel 
)
protectedvirtual

slot to be called when a channel is removed

virtual void makVrv::DtOsgChannel::slot_windowConfigurationModified ( const std::string &  deName,
const std::string &  oldWindowName,
const DtWindowConfiguration config 
)
protectedvirtual

slot to be called when the window configuration changes.

virtual void makVrv::DtOsgChannel::slot_onCoordinateSystemChanged ( )
protectedvirtual

receive signals from the shared state about coordinate system changes

virtual void makVrv::DtOsgChannel::throttleDatabasePager ( DtChannelManager mgr,
DtChannel channel 
)
protectedvirtual

slot to be called when a channel is added or removed.

Forces the database pager to limit the number of PagedLOD's so that the application is limited.

void makVrv::DtOsgChannel::stopUsingModelSetWork ( int  modelSet)
protected

Stop rendering the specified model set on this channel.

void makVrv::DtOsgChannel::startUsingModelSetWork ( int  modelSet)
protected

Start rendering the specified model set on this channel.

Friends And Related Function Documentation

friend class DtOsgChannelCreator
friend

Member Data Documentation

boost::signal<void (int, int, int, int)> makVrv::DtOsgChannel::signal_viewportChanged

Emitted when the channel's viewport changes dimensions.

Parameters are lower left x, y, width, and height, as in glViewport.

osg::ref_ptr<osgViewer::View> makVrv::DtOsgChannel::myView
protected
DtOsgWindow* makVrv::DtOsgChannel::myOsgWindow
protected
DtSensor* makVrv::DtOsgChannel::mySensor
protected
osg::ref_ptr<osg::Group> makVrv::DtOsgChannel::myRoot
protected
osg::ref_ptr<DtCameraNode> makVrv::DtOsgChannel::myPostProcessCamera
protected
osg::ref_ptr<osg::Texture> makVrv::DtOsgChannel::myPostProcessBuffer
protected
osg::ref_ptr<DtCameraNode> makVrv::DtOsgChannel::my2DCamera
protected
osg::ref_ptr<DtCameraNode> makVrv::DtOsgChannel::myNormalized2DCamera
protected
osg::ref_ptr<DtCameraNode> makVrv::DtOsgChannel::mySceneCamera
protected

The camera rendering the 3d scene.

osg::ref_ptr<DtCameraNode> makVrv::DtOsgChannel::myViewCamera
protected

The camera rendering the scene texture onto the channel.

osg::ref_ptr<osg::Texture2D> makVrv::DtOsgChannel::mySceneTexture
protected

The texture the 3d scene renders onto, which is then applied to the channel by the view camera.

bool makVrv::DtOsgChannel::myIsUsingTrackballManipulator
protected
bool makVrv::DtOsgChannel::myCoordinateSystemChanged
protected

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

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)