VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends
makVrv::DtPostProcessor Class Reference

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

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

Public Member Functions

 DtPostProcessor (const std::string &postProcessType, bool handles2D)
 CTOR.
virtual ~DtPostProcessor ()
 DTOR.
void setFragmentShaderSource (const char *source)
 Sets fragment shader source for this post-processor.
void setFragmentShaderFile (const std::string &fileName)
 Sets fragment shader file for this post-processor.
void setInputTexture (const DtChannel *channel, osg::Texture2D *texture)
 Sets the image that is postprocessed; this may be the 3D scene rendered to a texture, or the output texture of a chained post processor.
virtual void update (DtChannel *channel)=0
 Called once per frame, per channel.
osg::Texture2D * outputTexture ()
 Gets the output texture of this post processor, for use in chaining processors together.
void setIsFinalEffect (const DtChannel *channel, bool final)
 Called by the DtOsgPostProcessManager to indicate if this is the last post processor in the chain, and should render to the framebuffer.
osg::Camera * cameraForChannel (const DtChannel *channel)
 Gets the Camera node associated with this effect and channel.
virtual void releaseGLObjects ()
bool hasEffect (std::string effect)
 Does this post processor support this effect?
bool effectEnabled (std::string effect)
 Is this effect (post processor sub-component) enabled?
bool anyEffectEnabled ()
 Are any effects enabled?
std::list< std::string > supportedEffects ()
 Get a list of supported effects for this post processor.
bool handles2D () const
 Retrieves whether this post processor should be used in 2D orthographic views, as specified in its constructor.
const std::string & type () const
 Gets the type of the post processor.
bool postProcessorEnabled () const
 Is this post processor enabled?
virtual bool enableEffect (std::string effect)
 Enable a particular post processing technique For example, "wateroncamera" has techniques "rainsplash", "oceanspray", and "wavesplash".
virtual bool disableEffect (std::string effect)
 Enable a particular post processing technique For example, "wateroncamera" has techniques "rainsplash", "oceanspray", and "wavesplash".
virtual void enablePostProcessor ()
 Enable or disable the post processor.
virtual void disablePostProcessor ()
 Enable or disable the post processor.

Protected Types

typedef std::map< const
DtChannel *, osg::ref_ptr
< osg::Camera > > 
CameraMap
typedef boost::unordered_map
< std::string, bool
EffectMap

Protected Member Functions

void initialize ()
void addEffect (std::string effect)
 When constructing a post processor, add the names of the sub-components (effects) that can be enabled and disabled.
void setEnablePostProcessor (bool enabled)
 Set the post processor enabled state (true = enabled)

Protected Attributes

osg::ref_ptr< osg::Texture2D > myOutputTexture
osg::ref_ptr< osg::Texture2D > myInputTexture
osg::ref_ptr< osg::Program > myProgram
osg::ref_ptr< osg::Shader > myFragmentShader
osg::ref_ptr< osg::Geode > myQuad
charmyCustomFragmentSource
CameraMap myCameraMap
bool myHandles2DFlag
bool myEnabledFlag
std::string myType
EffectMap myEffects

Friends

class DtOsgPostProcessManager

Detailed Description

This class provides the OSG-specific implementation of a post processor.

A post processor has a type (ex. "wateronscreen") and a list of effects which are components that can be turned on or off (ex. "oceanspray", "rainsplash"). A post processor should register at least one effect. The post processor order is created in the DtPostProcessorFactory On channel creation, the DtPostProcessManager will create an instance of each post processor added to the factory's post processor list.

Member Typedef Documentation

typedef std::map<const DtChannel*, osg::ref_ptr<osg::Camera> > makVrv::DtPostProcessor::CameraMap
protected
typedef boost::unordered_map<std::string, bool> makVrv::DtPostProcessor::EffectMap
protected

Constructor & Destructor Documentation

makVrv::DtPostProcessor::DtPostProcessor ( const std::string &  postProcessType,
bool  handles2D 
)

CTOR.

Parameters
handles2DWhether this post processor should be used in 2D orthographic views.
virtual makVrv::DtPostProcessor::~DtPostProcessor ( )
virtual

DTOR.

Member Function Documentation

void makVrv::DtPostProcessor::setFragmentShaderSource ( const char source)

Sets fragment shader source for this post-processor.

The following uniforms will be automatically set for you: sampler2D inputImage; float aspectRatio; // (width over height) float fovy; // Vertical field of view (radians)

void makVrv::DtPostProcessor::setFragmentShaderFile ( const std::string &  fileName)

Sets fragment shader file for this post-processor.

The following uniforms will be automatically set for you: sampler2D inputImage; float aspectRatio; // (width over height) float fovy; // Vertical field of view (radians)

void makVrv::DtPostProcessor::setInputTexture ( const DtChannel channel,
osg::Texture2D *  texture 
)

Sets the image that is postprocessed; this may be the 3D scene rendered to a texture, or the output texture of a chained post processor.

Managed by the DtOsgPostProcessManager, you shouldn't need to call this yourself.

virtual void makVrv::DtPostProcessor::update ( DtChannel channel)
pure virtual

Called once per frame, per channel.

Implemented in makVrv::DtSenSimPostProcessor, makVrv::DtWaterOnScreen, and makVrv::DtDepthOfField.

osg::Texture2D* makVrv::DtPostProcessor::outputTexture ( )

Gets the output texture of this post processor, for use in chaining processors together.

It may be null if this is the last post processor, rendering directly to the frame buffer.

void makVrv::DtPostProcessor::setIsFinalEffect ( const DtChannel channel,
bool  final 
)

Called by the DtOsgPostProcessManager to indicate if this is the last post processor in the chain, and should render to the framebuffer.

osg::Camera* makVrv::DtPostProcessor::cameraForChannel ( const DtChannel channel)

Gets the Camera node associated with this effect and channel.

Use their statesets to set shader uniforms for your effect.

virtual void makVrv::DtPostProcessor::releaseGLObjects ( )
virtual
bool makVrv::DtPostProcessor::hasEffect ( std::string  effect)

Does this post processor support this effect?

bool makVrv::DtPostProcessor::effectEnabled ( std::string  effect)

Is this effect (post processor sub-component) enabled?

bool makVrv::DtPostProcessor::anyEffectEnabled ( )

Are any effects enabled?

virtual bool makVrv::DtPostProcessor::enableEffect ( std::string  effect)
virtual

Enable a particular post processing technique For example, "wateroncamera" has techniques "rainsplash", "oceanspray", and "wavesplash".

virtual bool makVrv::DtPostProcessor::disableEffect ( std::string  effect)
virtual

Enable a particular post processing technique For example, "wateroncamera" has techniques "rainsplash", "oceanspray", and "wavesplash".

std::list<std::string> makVrv::DtPostProcessor::supportedEffects ( )

Get a list of supported effects for this post processor.

bool makVrv::DtPostProcessor::handles2D ( ) const

Retrieves whether this post processor should be used in 2D orthographic views, as specified in its constructor.

const std::string& makVrv::DtPostProcessor::type ( ) const

Gets the type of the post processor.

virtual void makVrv::DtPostProcessor::enablePostProcessor ( )
virtual

Enable or disable the post processor.

virtual void makVrv::DtPostProcessor::disablePostProcessor ( )
virtual

Enable or disable the post processor.

bool makVrv::DtPostProcessor::postProcessorEnabled ( ) const

Is this post processor enabled?

void makVrv::DtPostProcessor::initialize ( )
protected
void makVrv::DtPostProcessor::addEffect ( std::string  effect)
protected

When constructing a post processor, add the names of the sub-components (effects) that can be enabled and disabled.

void makVrv::DtPostProcessor::setEnablePostProcessor ( bool  enabled)
protected

Set the post processor enabled state (true = enabled)

Friends And Related Function Documentation

friend class DtOsgPostProcessManager
friend

Member Data Documentation

osg::ref_ptr<osg::Texture2D> makVrv::DtPostProcessor::myOutputTexture
protected
osg::ref_ptr<osg::Texture2D> makVrv::DtPostProcessor::myInputTexture
protected
osg::ref_ptr<osg::Program> makVrv::DtPostProcessor::myProgram
protected
osg::ref_ptr<osg::Shader> makVrv::DtPostProcessor::myFragmentShader
protected
osg::ref_ptr<osg::Geode> makVrv::DtPostProcessor::myQuad
protected
char* makVrv::DtPostProcessor::myCustomFragmentSource
protected
CameraMap makVrv::DtPostProcessor::myCameraMap
protected
bool makVrv::DtPostProcessor::myHandles2DFlag
protected
bool makVrv::DtPostProcessor::myEnabledFlag
protected
std::string makVrv::DtPostProcessor::myType
protected
EffectMap makVrv::DtPostProcessor::myEffects
protected

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

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)