OpenWalnut  1.5.0dev
Public Member Functions | Private Attributes | List of all members
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 >:
+ Collaboration diagram for WGEViewportCallback< T, Source >:

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. More...
 
 WGEViewportCallback (size_t width, size_t height)
 Creates new instance of viewport callback and sets the viewport size to the specified size. More...
 
virtual ~WGEViewportCallback ()
 Destructor. More...
 
virtual void operator() (osg::Node *node, osg::NodeVisitor *nv)
 This operator gets called by OSG every update cycle. More...
 

Private Attributes

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

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

◆ WGEViewportCallback() [1/2]

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.

◆ WGEViewportCallback() [2/2]

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.

◆ ~WGEViewportCallback()

template<typename T , typename Source >
WGEViewportCallback< T, Source >::~WGEViewportCallback
virtual

Destructor.

Definition at line 112 of file WGEViewportCallback.h.

Member Function Documentation

◆ operator()()

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

◆ m_height

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.

◆ m_reference

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.

◆ m_width

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: