VR-Forces 5.0.1 Developer's Guide
 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 | Private Member Functions
makVrv::DtHdrDrawable Class Reference

class used to render hdr during the post processor camera draw

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

Classes

struct  DtHdrOptions
 

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)
 
 DtHdrDrawable (const DtHdrDrawable &orig, const osg::CopyOp &op)
 
virtual ~DtHdrDrawable ()
 
virtual osg::Object * clone (const osg::CopyOp &copyop) const
 
virtual osg::Object * cloneType () const
 
virtual void drawImplementation (osg::RenderInfo &renderInfo) const
 
virtual void setInputTexture (osg::Texture *inputTex)
 
virtual void setEnabled (bool enabled)
 
virtual bool enabled ()
 
virtual DtHdrOptionsoptions ()
 
virtual void setLumOverride (bool lumOverride)
 
virtual void setHdrPassthrough (bool enable)
 
virtual bool hdrPassthrough ()
 
virtual void cleanupGpuMemory ()
 
virtual float localHdrOutputScale ()
 
- Public Member Functions inherited from makVrv::DtPostProcessorDrawable
 DtPostProcessorDrawable (DtDe &de)
 
 DtPostProcessorDrawable (const DtPostProcessorDrawable &orig, const osg::CopyOp &op)
 
virtual ~DtPostProcessorDrawable ()
 
virtual void drawTexturedQuad (bool drawOnly=false) const
 
virtual void beginTexturedQuad () const
 
virtual void endTexturedQuad () const
 
virtual std::string preprocessorDefinesString (void) const
 
virtual DtGlProgramcreateProgram (const std::string &path, const std::string &prefixName, const std::string &preprocessor="") const
 

Protected Member Functions

virtual void initRenderTextures () const
 
virtual void downSample (DtGlTexture *src, DtGlTexture *dest, osg::State *state) const
 
virtual void downsample4x (DtGlTexture *src, DtGlTexture *dest, osg::State *state) const
 
virtual void extractHL (DtGlTexture *src, DtGlTexture *dest, osg::State *state) const
 
virtual void runPass (HDR_PASS prog, DtGlTexture *src, DtGlTexture *dest, osg::State *state) const
 
virtual void blur (DtGlTexture *src, DtGlTexture *dest, DtGlTexture *temp, int blurWidth, osg::State *state) const
 
virtual void getBufferPyramidSize (BUFFER_PYRAMID level, int *w, int *h) const
 
virtual void genStarStreak (int streak, float dir, float length) const
 
virtual void genGhostImage (const float *ghost_modulation1st, const float *ghost_modulation2nd, osg::State *state) const
 
virtual void composeEffect (void) const
 
virtual void toneMappingPass (osg::State *state) const
 
virtual void calculateLuminance (osg::State *state) const
 
virtual float adaptiveLuminance (osg::State *state) const
 
virtual bool adaptiveLuminanceCompute (osg::State *state) const
 
virtual float adaptiveLuminanceRead (osg::State *state) const
 
virtual float regularLuminance (osg::State *state) const
 
virtual float silverLiningLuminance (void) const
 
virtual void initShaders ()
 
virtual void computeColorModulationRedShift (float *color, float r, float g, float b, int num)
 
virtual void computeColorModulation (float *color, float r, float g, float b, int num)
 
virtual void computeColorModulationCoefficients ()
 
virtual void createComputeProgramIfNecessary (HDR_PASS pass, const std::string &name) const
 
virtual void createBlurProgramsIfNecessary () const
 
virtual std::string preprocessorDefinesString (HDR_PASS pass) const
 
virtual unsigned int inputTextureId (unsigned int &target, const DtGlTexture *src, osg::State *state) const
 
virtual void streakPass0 (int streak, float dec, const float step[2], float stride) const
 
virtual void streakPass1 (int streak, float dec, const float step[2], float stride) const
 
virtual void streakPass2 (int streak, float dec, const float step[2], float stride) const
 
virtual void ghostPass0 (const float *ghost_modulation1st) const
 
virtual void ghostPass1 (const float *ghost_modulation2nd) const
 
virtual void gaussianBlurComposePass (void) const
 
virtual void starStreakCompose (void) const
 
virtual void finalGlarePass (void) const
 
virtual void initializeUniformLocations (HDR_PASS pass) const
 
virtual void zeroOutUniformLocations ()
 
virtual void createToneMappingProgramIfNecessary (void) const
 
virtual void slot_hdrResolutionScaleChanged (int val)
 
- Protected Member Functions inherited from makVrv::DtPostProcessorDrawable
void setupGeometry () const
 

Protected Attributes

bool myEnabled
 
osg::ref_ptr< osg::Texture > myInputTex
 
float myAspectRatio
 
std::array< DtGlProgram
*, PROGSIZE
myMutableShaders
 
osg::ref_ptr< osg::Texture > myLensMask
 
DtHdrOptions myOptions
 
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]
 
DtSignalConnectionManager myConnections
 
DtGlTexturemyMutableComposebuffer [LEVEL_TOTAL]
 
DtGlTexturemyMutableBlurbufferA [LEVEL_TOTAL]
 
DtGlTexturemyMutableBlurbufferB [LEVEL_TOTAL]
 
DtGlTexturemyMutableStreakbufferA [8]
 
DtGlTexturemyMutableStreakbufferB [8]
 
DtGlTexturemyMutableStreakbufferFinal
 
DtGlTexturemyMutableGhost1stBuffer
 
DtGlTexturemyMutableGhost2ndBuffer
 
DtGlTexturemyMutableGlareBuffer
 
DtGlTexturemyMutableLumcurrent
 
unsigned int myMutableLumNext
 
const float * myMutableLumNextPtr
 
DtGlTexturemyMutableInitialBuffer
 
double myMutableLastAdpativeLumFrameTime
 
int myMutableExtractHlTresholdAndScalarLoc
 
int myMutableStarStreakStepSizeAndStrideLoc
 
int myMutableStarStreakColorCoeffLoc
 
int myMutableGhostImageScalarLoc
 
int myMutableGhostImageColorCoeffLoc
 
int myMutableGaussianBlurComposeCoeffLoc
 
int myMutableStarStreakComposeNumSamplersLoc
 
int myMutableFinalGlarecomposeMixCoeffLoc
 
int myMutableElapsedTimeLoc
 
int mySceneTexLoc
 
int myBlurTexLoc
 
int myScalesBlurTexLuminanceSaturationLoc
 
int myBlurAmountGammaEnablePassThroughLoc
 
float myMutableLastLuminanceValue
 
- Protected Attributes inherited from makVrv::DtPostProcessorDrawable
DtDemyDe
 
unsigned int myMutableVbo
 

Static Protected Attributes

static double theLastHdrFrameTime
 

Private Member Functions

 DtHdrDrawable ()=delete
 
 DtHdrDrawable (const DtHdrDrawable &)=delete
 
DtHdrDrawableoperator= (const DtHdrDrawable &)=delete
 

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 
)

constructor 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.

makVrv::DtHdrDrawable::DtHdrDrawable ( )
privatedelete

private default constructor. not allowed.

makVrv::DtHdrDrawable::DtHdrDrawable ( const DtHdrDrawable )
privatedelete

prevent copy-construction

Member Function Documentation

DtHdrDrawable& makVrv::DtHdrDrawable::operator= ( const DtHdrDrawable )
privatedelete

prevent assignment

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

overridden currently unneeded because the postprocessor drawable is always deleted/recreated because of channel creation/destruction virtual void releaseGLObjects(osg::State* state = 0) const; //!

overridden overriden

virtual void makVrv::DtHdrDrawable::setInputTexture ( osg::Texture *  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 float makVrv::DtHdrDrawable::localHdrOutputScale ( )
virtual

hdr output sclae this drawable calulated or used last frame

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

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

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

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

virtual void makVrv::DtHdrDrawable::downsample4x ( DtGlTexture src,
DtGlTexture 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 ( DtGlTexture src,
DtGlTexture 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,
DtGlTexture src,
DtGlTexture 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 ( DtGlTexture src,
DtGlTexture dest,
DtGlTexture temp,
int  blurWidth,
osg::State *  state 
) const
protectedvirtual

blur pass

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 
) 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 ( void  ) 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 float makVrv::DtHdrDrawable::adaptiveLuminance ( osg::State *  state) const
protectedvirtual

adaptive luminance (do the pass, read, etc)

virtual bool makVrv::DtHdrDrawable::adaptiveLuminanceCompute ( osg::State *  state) const
protectedvirtual

compute adaptive luminance

virtual float makVrv::DtHdrDrawable::adaptiveLuminanceRead ( osg::State *  state) const
protectedvirtual

read back the adaptive luminance

virtual float makVrv::DtHdrDrawable::regularLuminance ( osg::State *  state) const
protectedvirtual

non-adaptive luminance

virtual float makVrv::DtHdrDrawable::silverLiningLuminance ( void  ) const
protectedvirtual

luminance per Silver Lining

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

initialize the rest of the HDR shaders.

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

helper functions used for creating color constants

virtual void makVrv::DtHdrDrawable::computeColorModulation ( float *  color,
float  r,
float  g,
float  b,
int  num 
)
protectedvirtual
virtual void makVrv::DtHdrDrawable::computeColorModulationCoefficients ( )
protectedvirtual
virtual void makVrv::DtHdrDrawable::createComputeProgramIfNecessary ( HDR_PASS  pass,
const std::string &  name 
) const
protectedvirtual

helper function to create compute program

virtual void makVrv::DtHdrDrawable::createBlurProgramsIfNecessary ( ) const
protectedvirtual
virtual std::string makVrv::DtHdrDrawable::preprocessorDefinesString ( HDR_PASS  pass) const
protectedvirtual

preprocessor string taking into account the current options. NOTE: This is a different signature than base class function (but calls up to base class)

virtual unsigned int makVrv::DtHdrDrawable::inputTextureId ( unsigned int target,
const DtGlTexture src,
osg::State *  state 
) const
protectedvirtual

get the OpenGL texture id and target (2D for regular, 2D array if in VR)

virtual void makVrv::DtHdrDrawable::streakPass0 ( int  streak,
float  dec,
const float  step[2],
float  stride 
) const
protectedvirtual

streak passes

virtual void makVrv::DtHdrDrawable::streakPass1 ( int  streak,
float  dec,
const float  step[2],
float  stride 
) const
protectedvirtual
virtual void makVrv::DtHdrDrawable::streakPass2 ( int  streak,
float  dec,
const float  step[2],
float  stride 
) const
protectedvirtual
virtual void makVrv::DtHdrDrawable::ghostPass0 ( const float *  ghost_modulation1st) const
protectedvirtual

ghost image passes

virtual void makVrv::DtHdrDrawable::ghostPass1 ( const float *  ghost_modulation2nd) const
protectedvirtual
virtual void makVrv::DtHdrDrawable::gaussianBlurComposePass ( void  ) const
protectedvirtual

final passes

virtual void makVrv::DtHdrDrawable::starStreakCompose ( void  ) const
protectedvirtual
virtual void makVrv::DtHdrDrawable::finalGlarePass ( void  ) const
protectedvirtual
virtual void makVrv::DtHdrDrawable::initializeUniformLocations ( HDR_PASS  pass) const
protectedvirtual

init uniform locations from the compiled shader

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

set initial value of uniform locations to an invalid value

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

create the tone mapping program if not created already

virtual void makVrv::DtHdrDrawable::slot_hdrResolutionScaleChanged ( int  val)
protectedvirtual

Trigger shader recompile if resolution scale has changed.

Member Data Documentation

bool makVrv::DtHdrDrawable::myEnabled
protected
osg::ref_ptr<osg::Texture> makVrv::DtHdrDrawable::myInputTex
protected
double makVrv::DtHdrDrawable::theLastHdrFrameTime
staticprotected
float makVrv::DtHdrDrawable::myAspectRatio
protected
std::array<DtGlProgram*, PROGSIZE> makVrv::DtHdrDrawable::myMutableShaders
mutableprotected
osg::ref_ptr<osg::Texture> makVrv::DtHdrDrawable::myLensMask
protected
DtHdrOptions makVrv::DtHdrDrawable::myOptions
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
DtSignalConnectionManager makVrv::DtHdrDrawable::myConnections
protected
DtGlTexture* makVrv::DtHdrDrawable::myMutableComposebuffer[LEVEL_TOTAL]
mutableprotected

mutables needed since osg drawable draw implementations are const functions. This allows us to keep track of a bit of state that is needed between frames Also these are protected instead of private because they may be needed by classes derived from this class

Render textures need to be initialized in draw implementation so they need to be mutable...

DtGlTexture* makVrv::DtHdrDrawable::myMutableBlurbufferA[LEVEL_TOTAL]
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableBlurbufferB[LEVEL_TOTAL]
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableStreakbufferA[8]
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableStreakbufferB[8]
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableStreakbufferFinal
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableGhost1stBuffer
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableGhost2ndBuffer
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableGlareBuffer
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableLumcurrent
mutableprotected
unsigned int makVrv::DtHdrDrawable::myMutableLumNext
mutableprotected
const float* makVrv::DtHdrDrawable::myMutableLumNextPtr
mutableprotected
DtGlTexture* makVrv::DtHdrDrawable::myMutableInitialBuffer
mutableprotected
double makVrv::DtHdrDrawable::myMutableLastAdpativeLumFrameTime
mutableprotected

need to keep track of the previous frame time in draw implementation so this needs to be mutable.

int makVrv::DtHdrDrawable::myMutableExtractHlTresholdAndScalarLoc
mutableprotected

locations of various uniforms in the shaders

int makVrv::DtHdrDrawable::myMutableStarStreakStepSizeAndStrideLoc
mutableprotected
int makVrv::DtHdrDrawable::myMutableStarStreakColorCoeffLoc
mutableprotected
int makVrv::DtHdrDrawable::myMutableGhostImageScalarLoc
mutableprotected
int makVrv::DtHdrDrawable::myMutableGhostImageColorCoeffLoc
mutableprotected
int makVrv::DtHdrDrawable::myMutableGaussianBlurComposeCoeffLoc
mutableprotected
int makVrv::DtHdrDrawable::myMutableStarStreakComposeNumSamplersLoc
mutableprotected
int makVrv::DtHdrDrawable::myMutableFinalGlarecomposeMixCoeffLoc
mutableprotected
int makVrv::DtHdrDrawable::myMutableElapsedTimeLoc
mutableprotected
int makVrv::DtHdrDrawable::mySceneTexLoc
mutableprotected
int makVrv::DtHdrDrawable::myBlurTexLoc
mutableprotected
int makVrv::DtHdrDrawable::myScalesBlurTexLuminanceSaturationLoc
mutableprotected
int makVrv::DtHdrDrawable::myBlurAmountGammaEnablePassThroughLoc
mutableprotected
float makVrv::DtHdrDrawable::myMutableLastLuminanceValue
mutableprotected

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

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)