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

class used to render hdr during the post processor camera draw More...

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

Classes

struct  DtHdrOptions
 structure to hold all the HDR settings so they can more easily be passed to the drawable. More...

Public Types

enum  HDR_PASS {
  DOWNSAMPLE = 0, DOWNSAMPLE4X, BLURH4, BLURV4,
  BLURH6, BLURV6, BLURH10, BLURV10,
  BLURH12, BLURV12, TONEMAPPING, EXTRACTHL,
  GAUSCOMP, STARSTREAK, GLARECOMP, STARCOMP,
  GHOSTIMAGE, CALCADAPTEDLUM, PROGSIZE
}
enum  BUFFER_PYRAMID {
  LEVEL_0 = 0, LEVEL_1, LEVEL_2, LEVEL_3,
  LEVEL_4, LEVEL_5, LEVEL_TOTAL
}

Public Member Functions

 DtHdrDrawable (DtDe &de, DtHdrOptions options, osg::Texture *lensFlareTexture)
 contructor that passes in the options needed for setting up HDR
 DtHdrDrawable (const DtHdrDrawable &orig, const osg::CopyOp &op)
 Copy constructor needed because it is derived from osg::Drawable.
virtual ~DtHdrDrawable ()
 Destructor.
virtual osg::Object * clone (const osg::CopyOp &copyop) const
 required functions for derriving from osg::Drawable
virtual osg::Object * cloneType () const
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
virtual void setInputTexture (osg::Texture2D *inputTex)
 setter for the input texture from the previous post processor or main rendering
virtual void setEnabled (bool enabled)
 setter/getter for whether or not this effect is enabled.
virtual bool enabled ()
virtual DtHdrOptionsoptions ()
 getter for the hdr options. returns a reference so modifications will effect this drawable.
virtual void setLumOverride (bool lumOverride)
 setter for whether or not the luminance override should be turned on for this drawable the luminance override is used to render modes that have the sky turned of when HDR is turned on.
virtual void setHdrPassthrough (bool enable)
 getter/setter for the whether the HDR post processor
virtual bool hdrPassthrough ()
virtual void cleanupGpuMemory ()
 cleanup the Gpu memory. this should be called in the render thread before throwing away a ref_ptr to the drawable.
- Public Member Functions inherited from makVrv::DtPostProcessorDrawable
 DtPostProcessorDrawable ()
 DtPostProcessorDrawable (const DtPostProcessorDrawable &orig, const osg::CopyOp &op)
virtual void drawTexturedQuad () const
 render a simple quad using the current opengl state (setup shader/uniform/textures before calling)

Protected Member Functions

virtual void initRenderTextures () const
 initializes all the render textures if they have not been initialized yet
virtual void downsample (DtGlRenderTexture *src, DtGlRenderTexture *dest, osg::State *state) const
 downsample the the src render texture into the dest render texture (or upsample if the dest is larger)
virtual void downsample4x (DtGlRenderTexture *src, DtGlRenderTexture *dest, osg::State *state) const
 same as downsample except it samples a 4x4 square in the src for each sample in the dest this helps reduce flickering for really bright objects like light points.
virtual void extractHL (DtGlRenderTexture *src, DtGlRenderTexture *dest, osg::State *state) const
 extract the anything above the lumThreshold and put it in the dest render texture
virtual void runPass (HDR_PASS prog, DtGlRenderTexture *src, DtGlRenderTexture *dest, osg::State *state) const
 run the specified prog on the src and put the result in dest. Used mostly for blur shaders.
virtual void blur (DtGlRenderTexture *src, DtGlRenderTexture *dest, DtGlRenderTexture *temp, int blurWidth, osg::State *state) const
 runs a couple blur passes on the src and puts the result in dest using temp as the intermediate result.
virtual void getBufferPyramidSize (BUFFER_PYRAMID level, int *w, int *h) const
 calculate the buffer size for a particular blur level
virtual void genStarStreak (int streak, float dir, float length, osg::State *state) const
 run the star streak shaders for a particular streak direction and length
virtual void genGhostImage (const float *ghost_modulation1st, const float *ghost_modulation2nd, osg::State *state) const
 run the shaders to generate the ghosting/lens flare effect
virtual void composeEffect (osg::State *state) const
 compose the three HDR effects into a single render texture.
virtual void toneMappingPass (osg::State *state) const
 run the final tone mapping pass that combines the effects texture with the main rendering and scales everything appropriately
virtual void calculateLuminance (osg::State *state) const
 calculate the luminace scaling to use in the tone mapping
virtual void initBlurCode ()
 initialize the blur shaders
virtual void initShaders ()
 initialize the rest of the HDR shaders.
virtual void colorModulationRedShift (float *color, float r, float g, float b, int num)
virtual void colorModulation (float *color, float r, float g, float b, int num)
virtual void modulateColor ()

Protected Attributes

bool myEnabled
osg::ref_ptr< osg::Texture2D > myInputTex
float myAspectRatio
osg::ref_ptr< osg::Program > myShaders [PROGSIZE]
osg::ref_ptr< osg::Texture > myLensMask
DtHdrOptions myOptions
DtDemyDe
bool myLumOverride
bool myEnableHdrPassthrough
float myStarModulation1st [16]
float myStarModulation2nd [16]
float myStarModulation3rd [16]
float myFilmicGhostModulation1st [16]
float myFilmicGhostModulation2nd [16]
float myCameraGhostModulation1st [16]
float myCameraGhostModulation2nd [16]
float myHoriModulation1st [16]
float myHoriModulation2nd [16]
float myHoriModulation3rd [16]
DtGlRenderTexturemyMutableComposebuffer [LEVEL_TOTAL]
DtGlRenderTexturemyMutableBlurbufferA [LEVEL_TOTAL]
DtGlRenderTexturemyMutableBlurbufferB [LEVEL_TOTAL]
DtGlRenderTexturemyMutableStreakbufferA [8]
DtGlRenderTexturemyMutableStreakbufferB [8]
DtGlRenderTexturemyMutableStreakbufferFinal
DtGlRenderTexturemyMutableGhost1stBuffer
DtGlRenderTexturemyMutableGhost2ndBuffer
DtGlRenderTexturemyMutableGlareBuffer
DtGlRenderTexturemyMutableLumcurrent
DtGlRenderTexturemyMutableLumPrev
DtGlRenderTexturemyMutableLumNext
DtGlRenderTexturemyMutableInitialBuffer
GLuint myMutableLumPbos [theNumLumCapturePbos]
int myMutableCurLumBuffer
int myMutableInitializedPboIndex
double myMutableLastAdpativeLumFrameTime

Static Protected Attributes

static const int theNumLumCapturePbos = 5
static double theLastHdrFrameTime

Additional Inherited Members

- Static Public Member Functions inherited from makVrv::DtPostProcessorDrawable
static osg::Program * createPostProcessorProgram (DtDe &myDe, const std::string &name)
 create an osg program based on the name (name_ps.glsl and name_vs.glsl files are used)

Detailed Description

class used to render hdr during the post processor camera draw

Member Enumeration Documentation

Enumerator:
DOWNSAMPLE 
DOWNSAMPLE4X 
BLURH4 
BLURV4 
BLURH6 
BLURV6 
BLURH10 
BLURV10 
BLURH12 
BLURV12 
TONEMAPPING 
EXTRACTHL 
GAUSCOMP 
STARSTREAK 
GLARECOMP 
STARCOMP 
GHOSTIMAGE 
CALCADAPTEDLUM 
PROGSIZE 
Enumerator:
LEVEL_0 
LEVEL_1 
LEVEL_2 
LEVEL_3 
LEVEL_4 
LEVEL_5 
LEVEL_TOTAL 

Constructor & Destructor Documentation

makVrv::DtHdrDrawable::DtHdrDrawable ( DtDe de,
DtHdrOptions  options,
osg::Texture *  lensFlareTexture 
)

contructor that passes in the options needed for setting up HDR

makVrv::DtHdrDrawable::DtHdrDrawable ( const DtHdrDrawable orig,
const osg::CopyOp &  op 
)

Copy constructor needed because it is derived from osg::Drawable.

virtual makVrv::DtHdrDrawable::~DtHdrDrawable ( )
virtual

Destructor.

Member Function Documentation

virtual osg::Object* makVrv::DtHdrDrawable::clone ( const osg::CopyOp &  copyop) const
inlinevirtual

required functions for derriving from osg::Drawable

virtual osg::Object* makVrv::DtHdrDrawable::cloneType ( ) const
inlinevirtual
virtual void makVrv::DtHdrDrawable::drawImplementation ( osg::RenderInfo &  renderInfo) const
virtual
virtual void makVrv::DtHdrDrawable::setInputTexture ( osg::Texture2D *  inputTex)
virtual

setter for the input texture from the previous post processor or main rendering

virtual void makVrv::DtHdrDrawable::setEnabled ( bool  enabled)
virtual

setter/getter for whether or not this effect is enabled.

virtual bool makVrv::DtHdrDrawable::enabled ( )
virtual
virtual DtHdrOptions& makVrv::DtHdrDrawable::options ( )
virtual

getter for the hdr options. returns a reference so modifications will effect this drawable.

virtual void makVrv::DtHdrDrawable::setLumOverride ( bool  lumOverride)
virtual

setter for whether or not the luminance override should be turned on for this drawable the luminance override is used to render modes that have the sky turned of when HDR is turned on.

virtual void makVrv::DtHdrDrawable::setHdrPassthrough ( bool  enable)
virtual

getter/setter for the whether the HDR post processor

virtual bool makVrv::DtHdrDrawable::hdrPassthrough ( )
virtual
virtual void makVrv::DtHdrDrawable::cleanupGpuMemory ( )
virtual

cleanup the Gpu memory. this should be called in the render thread before throwing away a ref_ptr to the drawable.

virtual void makVrv::DtHdrDrawable::initRenderTextures ( ) const
protectedvirtual

initializes all the render textures if they have not been initialized yet

virtual void makVrv::DtHdrDrawable::downsample ( DtGlRenderTexture src,
DtGlRenderTexture dest,
osg::State *  state 
) const
protectedvirtual

downsample the the src render texture into the dest render texture (or upsample if the dest is larger)

virtual void makVrv::DtHdrDrawable::downsample4x ( DtGlRenderTexture src,
DtGlRenderTexture dest,
osg::State *  state 
) const
protectedvirtual

same as downsample except it samples a 4x4 square in the src for each sample in the dest this helps reduce flickering for really bright objects like light points.

virtual void makVrv::DtHdrDrawable::extractHL ( DtGlRenderTexture src,
DtGlRenderTexture dest,
osg::State *  state 
) const
protectedvirtual

extract the anything above the lumThreshold and put it in the dest render texture

virtual void makVrv::DtHdrDrawable::runPass ( HDR_PASS  prog,
DtGlRenderTexture src,
DtGlRenderTexture dest,
osg::State *  state 
) const
protectedvirtual

run the specified prog on the src and put the result in dest. Used mostly for blur shaders.

virtual void makVrv::DtHdrDrawable::blur ( DtGlRenderTexture src,
DtGlRenderTexture dest,
DtGlRenderTexture temp,
int  blurWidth,
osg::State *  state 
) const
protectedvirtual

runs a couple blur passes on the src and puts the result in dest using temp as the intermediate result.

virtual void makVrv::DtHdrDrawable::getBufferPyramidSize ( BUFFER_PYRAMID  level,
int w,
int h 
) const
protectedvirtual

calculate the buffer size for a particular blur level

virtual void makVrv::DtHdrDrawable::genStarStreak ( int  streak,
float  dir,
float  length,
osg::State *  state 
) const
protectedvirtual

run the star streak shaders for a particular streak direction and length

virtual void makVrv::DtHdrDrawable::genGhostImage ( const float *  ghost_modulation1st,
const float *  ghost_modulation2nd,
osg::State *  state 
) const
protectedvirtual

run the shaders to generate the ghosting/lens flare effect

virtual void makVrv::DtHdrDrawable::composeEffect ( osg::State *  state) const
protectedvirtual

compose the three HDR effects into a single render texture.

virtual void makVrv::DtHdrDrawable::toneMappingPass ( osg::State *  state) const
protectedvirtual

run the final tone mapping pass that combines the effects texture with the main rendering and scales everything appropriately

virtual void makVrv::DtHdrDrawable::calculateLuminance ( osg::State *  state) const
protectedvirtual

calculate the luminace scaling to use in the tone mapping

virtual void makVrv::DtHdrDrawable::initBlurCode ( )
protectedvirtual

initialize the blur shaders

virtual void makVrv::DtHdrDrawable::initShaders ( )
protectedvirtual

initialize the rest of the HDR shaders.

virtual void makVrv::DtHdrDrawable::colorModulationRedShift ( float *  color,
float  r,
float  g,
float  b,
int  num 
)
protectedvirtual
virtual void makVrv::DtHdrDrawable::colorModulation ( float *  color,
float  r,
float  g,
float  b,
int  num 
)
protectedvirtual
virtual void makVrv::DtHdrDrawable::modulateColor ( )
protectedvirtual

Member Data Documentation

bool makVrv::DtHdrDrawable::myEnabled
protected
osg::ref_ptr<osg::Texture2D> makVrv::DtHdrDrawable::myInputTex
protected
const int makVrv::DtHdrDrawable::theNumLumCapturePbos = 5
staticprotected
double makVrv::DtHdrDrawable::theLastHdrFrameTime
staticprotected
float makVrv::DtHdrDrawable::myAspectRatio
protected
osg::ref_ptr<osg::Program> makVrv::DtHdrDrawable::myShaders[PROGSIZE]
protected
osg::ref_ptr<osg::Texture> makVrv::DtHdrDrawable::myLensMask
protected
DtHdrOptions makVrv::DtHdrDrawable::myOptions
protected
DtDe& makVrv::DtHdrDrawable::myDe
protected
bool makVrv::DtHdrDrawable::myLumOverride
protected
bool makVrv::DtHdrDrawable::myEnableHdrPassthrough
protected
float makVrv::DtHdrDrawable::myStarModulation1st[16]
protected
float makVrv::DtHdrDrawable::myStarModulation2nd[16]
protected
float makVrv::DtHdrDrawable::myStarModulation3rd[16]
protected
float makVrv::DtHdrDrawable::myFilmicGhostModulation1st[16]
protected
float makVrv::DtHdrDrawable::myFilmicGhostModulation2nd[16]
protected
float makVrv::DtHdrDrawable::myCameraGhostModulation1st[16]
protected
float makVrv::DtHdrDrawable::myCameraGhostModulation2nd[16]
protected
float makVrv::DtHdrDrawable::myHoriModulation1st[16]
protected
float makVrv::DtHdrDrawable::myHoriModulation2nd[16]
protected
float makVrv::DtHdrDrawable::myHoriModulation3rd[16]
protected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableComposebuffer[LEVEL_TOTAL]
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableBlurbufferA[LEVEL_TOTAL]
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableBlurbufferB[LEVEL_TOTAL]
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableStreakbufferA[8]
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableStreakbufferB[8]
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableStreakbufferFinal
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableGhost1stBuffer
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableGhost2ndBuffer
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableGlareBuffer
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableLumcurrent
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableLumPrev
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableLumNext
mutableprotected
DtGlRenderTexture* makVrv::DtHdrDrawable::myMutableInitialBuffer
mutableprotected
GLuint makVrv::DtHdrDrawable::myMutableLumPbos[theNumLumCapturePbos]
mutableprotected
int makVrv::DtHdrDrawable::myMutableCurLumBuffer
mutableprotected
int makVrv::DtHdrDrawable::myMutableInitializedPboIndex
mutableprotected
double makVrv::DtHdrDrawable::myMutableLastAdpativeLumFrameTime
mutableprotected

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

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)