OpenWalnut  1.4.0
Public Member Functions | Private Attributes
WGEViewportCallback< T, Source > Class Template Reference

This callback is useful to update viewport information on several nodes supporting it. More...

#include <WGEViewportCallback.h>

+ Inheritance diagram for WGEViewportCallback< T, Source >:

List of all members.

Public Member Functions

 WGEViewportCallback (osg::ref_ptr< Source > reference)
 Creates new instance of viewport callback and sets the viewport size to the reference camera size.
 WGEViewportCallback (size_t width, size_t height)
 Creates new instance of viewport callback and sets the viewport size to the specified size.
virtual ~WGEViewportCallback ()
 Destructor.
virtual void operator() (osg::Node *node, osg::NodeVisitor *nv)
 This operator gets called by OSG every update cycle.

Private Attributes

osg::ref_ptr< Source > m_reference
 The reference camera to use.
size_t m_width
 Forced viewport width.
size_t m_height
 Forced viewport height.

Detailed Description

template<typename T, typename Source = WGECamera>
class WGEViewportCallback< T, Source >

This callback is useful to update viewport information on several nodes supporting it.

The specified type must support an setViewport method. This is especially useful to keep offscreen render cameras in sync with the scene cam or to update HUD viewport information. Note that the order of execution of callbacks for a node can cause problems as the new viewport might get set after it is needed.

Template Parameters:
Tthe type supporting setViewport
Sourcethe type from who the viewport should be acquired by using osg::Viewport* getViewport()

Definition at line 42 of file WGEViewportCallback.h.


Constructor & Destructor Documentation

template<typename T , typename Source >
WGEViewportCallback< T, Source >::WGEViewportCallback ( osg::ref_ptr< Source >  reference) [explicit]

Creates new instance of viewport callback and sets the viewport size to the reference camera size.

Parameters:
referenceset the viewport to the one of the reference camera.

Definition at line 92 of file WGEViewportCallback.h.

template<typename T , typename Source >
WGEViewportCallback< T, Source >::WGEViewportCallback ( size_t  width,
size_t  height 
)

Creates new instance of viewport callback and sets the viewport size to the specified size.

Parameters:
widthviewport width
heightviewport height

Definition at line 102 of file WGEViewportCallback.h.

template<typename T , typename Source >
WGEViewportCallback< T, Source >::~WGEViewportCallback ( ) [virtual]

Destructor.

Definition at line 112 of file WGEViewportCallback.h.


Member Function Documentation

template<typename T , typename Source >
void WGEViewportCallback< T, Source >::operator() ( osg::Node *  node,
osg::NodeVisitor *  nv 
) [virtual]

This operator gets called by OSG every update cycle.

It applies the viewport.

Parameters:
nodethe osg node
nvthe node visitor

Definition at line 118 of file WGEViewportCallback.h.


Member Data Documentation

template<typename T , typename Source = WGECamera>
size_t WGEViewportCallback< T, Source >::m_height [private]

Forced viewport height.

Definition at line 88 of file WGEViewportCallback.h.

template<typename T , typename Source = WGECamera>
osg::ref_ptr< Source > WGEViewportCallback< T, Source >::m_reference [private]

The reference camera to use.

Definition at line 78 of file WGEViewportCallback.h.

template<typename T , typename Source = WGECamera>
size_t WGEViewportCallback< T, Source >::m_width [private]

Forced viewport width.

Definition at line 83 of file WGEViewportCallback.h.


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