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

State component that injects lighting shaders and uniforms into a state set. More...

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

Classes

struct  TileLightIndexInfo
 struct for holding information about a camera's tile light index map More...
 

Public Member Functions

 DtOsgLightingComponent (DtDe &de)
 CTOR. More...
 
virtual ~DtOsgLightingComponent ()
 DTOR. More...
 
virtual void update (const VectorLights &lights, const osg::State &state, const osg::Camera *camera)
 Update the lighting uniforms with new light data. More...
 
virtual const Vector2_uint32tileSize (void) const
 get the tile size More...
 
virtual const Vector2_uint32gridMaxDims (void) const
 get the grid max dimensions More...
 
virtual void updateLightSourceIndexBufferHandle (const osg::Camera *camera, DtGlBuffer *handle, int maxNumLightSources)
 add/update/remove a light source index buffer handle/size entry in the map More...
 
virtual osg::Uniform * getEnableLightingUniform () const
 Gets the uniform that toggles lighting. More...
 
virtual void setAmbientFactor (float ambientFactor)
 Sets the ambient factor uniform. More...
 
virtual void setUseGlobalAmbient (bool useGlobalAmbient)
 Enables/Disables the usage of the material ambient and global ambient. More...
 
virtual void setDiffuseFactor (float diffuseFactor)
 Sets the difuse factor uniform. More...
 
virtual void setUseGlobalDiffuse (bool useGlobalDiffuse)
 Enables/Disables the usage of the material diffuse and global diffuse. More...
 
virtual void setUseHDR (bool useHDR)
 Enables/Disables HDR Lighting. More...
 
virtual void slot_reloadShader ()
 reload the light source compute shaders More...
 
virtual void setDirty (bool isDirty)
 Sets dirty state for reinstallation. More...
 
virtual void setEmissionFactor (float emissionFactor)
 Sets the emission factor uniform. More...
 
virtual bool dirty () const
 Checks if component needs to be re-installed. More...
 
virtual void releaseGLObjects (void)
 
virtual bool install (osg::StateSet *stateset)
 Install this component on a state set. More...
 
virtual bool uninstall (osg::StateSet *stateset)
 Uninstall this component from a state set. More...
 
virtual bool isInstalled (void) const
 checks whether its installed More...
 
virtual void setComponentVisualizationMode (int mode)
 set the component visualization mode More...
 
- Public Member Functions inherited from makVrv::DtOsgStateComponent
 DtOsgStateComponent (DtDe &de)
 CTOR. More...
 

Static Public Member Functions

static int textureStartOffset (void)
 

Protected Types

typedef std::unordered_map
< DtGlBuffer *, int
BufferToLightIndexMap
 
typedef std::unordered_map
< const osg::Camera
*, TileLightIndexInfo
CameraToTileLightIndexMapInfoMap
 

Protected Member Functions

virtual void setLightPointScale (double scale)
 
virtual void setDynamicLightScale (double scale)
 
virtual void setEmissiveTextureScale (double scale)
 
virtual void setSpecularScale (double scale)
 
virtual void setShininessScale (double scale)
 
virtual osg::ref_ptr
< osg::Uniform > 
createUniform (const std::string &name, osg::Uniform::Type type, int count=1)
 
virtual void packLights (const osg::Matrixd &normalMatrix, const VectorLights &lights, const osg::State &state)
 
virtual void updateTextureLightDataGrid (void)
 
virtual void updateTiledShadingData (const VectorLights &lights, const osg::State &state, const osg::Camera *camera)
 run the compute shaders in order to update the per camera lighting data and bin the lights in screenspace. More...
 
virtual void updateTileLightIndexList (const std::vector< Matrix4_64 > &projectionMatrix, const std::vector< Vector3_64 > &vWorldEye, const std::vector< Vector3_64 > &vWorldCenter, const std::vector< Vector3_64 > &vWorldUp, const Vector2_uint32 &viewportSize, const osg::Camera *camera)
 Updates the per-light-grid index lists. More...
 
virtual void initializeColorRampTexture ()
 Updates the offsets and counts into the index grid. More...
 
virtual int lightGridSize ()
 Returns the number of lights in the light grid. More...
 
virtual int maxUboSize ()
 Returns the maximum UBO size that we'll use for a light UBO. More...
 
- Protected Member Functions inherited from makVrv::DtOsgStateComponent
virtual ~DtOsgStateComponent ()
 DTOR. More...
 
virtual const std::string & loadShaderSource (const std::string &strFileName) const
 Loads shader source code from a path. More...
 

Protected Attributes

osg::ref_ptr< osg::Uniform > myEnableLightingUniform
 
osg::ref_ptr< osg::Uniform > myLightingOffClampUniform
 
std::vector< osg::ref_ptr
< osg::Uniform > > 
myUniforms
 
DtLightDatamyLightGrid
 
std::array< DtGlBuffer
*, DtBindingManager::theLightBlockCount
myLightUBO
 
DtTileSpaceLightGridmyTileSpaceLightGrid
 
DtGlBuffermyTileLightIndexListSsbo
 Holds a set of indexes, one per light tile. More...
 
DtGlBuffermyTileLightIndexListSsboPreCompute
 
DtGlBuffermyTileLightIntersectionDataSsbo
 
DtGlBuffermyTileLightIndexBuffersInfoSsbo
 
CameraToTileLightIndexMapInfoMap myCameraToTileLightIndexMapInfoMap
 
DtGlSimpleTexturemyColorRampTexture
 
osg::ref_ptr< osg::Uniform > myColorRampTextureUniform
 
osg::ref_ptr
< TextureApplyAttribute
myTextureApplyAttribute
 
osg::ref_ptr
< DtUniformBufferObjectApplyAttribute
myUniformBufferObjectApplyAttribute
 
osg::ref_ptr
< DtShaderStorageBufferApplyAttribute
myShaderStorageBufferApplyAttribute
 
osg::ref_ptr< osg::Uniform > myViewportSizeUniform
 
osg::ref_ptr< osg::Uniform > myLightGridTileDimUniform
 
osg::ref_ptr< osg::Uniform > myLightGridMaxDimUniform
 
osg::ref_ptr< osg::Uniform > myLightPerViewOffsetUniform
 
osg::ref_ptr< osg::Uniform > myAmbientFactorUniform
 
bool myUseGlobalAmbient
 
osg::ref_ptr< osg::Uniform > myUseGlobalAmbientUniform
 
osg::ref_ptr< osg::Uniform > myDiffuseFactorUniform
 
bool myUseGlobalDiffuse
 
osg::ref_ptr< osg::Uniform > myUseGlobalDiffuseUniform
 
bool myUseHDR
 
bool myDirty
 
osg::ref_ptr< osg::Uniform > myEmissionFactorUniform
 
osg::ref_ptr< osg::Uniform > myTransmittanceFactorUniform
 
osg::ref_ptr< osg::Uniform > myModelTransmittanceUniform
 
osg::ref_ptr< osg::Uniform > myLightPointScaleUniform
 
osg::ref_ptr< osg::Uniform > myDynamicLightScaleUniform
 
osg::ref_ptr< osg::Uniform > myEmissiveTextureScaleUniform
 
osg::ref_ptr< osg::Uniform > mySpecularScaleUniform
 
osg::ref_ptr< osg::Uniform > myShininessScaleUniform
 
osg::ref_ptr< osg::Uniform > myUpVectorUniform
 
osg::ref_ptr< osg::Uniform > myBDRFLutUniform
 
osg::ref_ptr< osg::Texture2D > myBDRFLutTexture
 
osg::ref_ptr< osg::Image > myBrdfLutImage
 
osg::ref_ptr< osg::Uniform > myComponentDebugUniform
 
osg::ref_ptr< osg::Uniform > myModelTypeDefaultUniform
 
VectorLights myViewSpaceLightsScratchPad
 
bool myIsInstalled
 
DtSignalConnectionManager myConnections
 
GLint myMaxUboSizeInBytes
 
int myLightGridSize
 
const DtBindingManagermyBindingManager
 
DtLightComputeProgrammyLightComputeProgram
 
osg::ref_ptr< osg::Texture > myDebugTexture
 
- Protected Attributes inherited from makVrv::DtOsgStateComponent
DtDemyDe
 
DtOsgShaderFilesCachemyShaderFilesCache
 

Static Protected Attributes

static bool bColorRampTextureWasTried
 
static const float theLightPointHdrScalar
 
static const float theDynamicLightHdrScalar
 
static const float theEmissiveTextureHdrScalar
 

Private Member Functions

 DtOsgLightingComponent ()=delete
 private default constructor. not allowed. More...
 
 DtOsgLightingComponent (const DtOsgLightingComponent &)=delete
 prevent copy-construction More...
 
DtOsgLightingComponentoperator= (const DtOsgLightingComponent &)=delete
 prevent assignment More...
 

Detailed Description

State component that injects lighting shaders and uniforms into a state set.

It also has a DtLightComputeProgram that does a 2 pass set up/computation of lights affecting screen space tiles, which is then subsequently used by the lighting

Member Typedef Documentation

typedef std::unordered_map<DtGlBuffer*, int> makVrv::DtOsgLightingComponent::BufferToLightIndexMap
protected
typedef std::unordered_map<const osg::Camera*, TileLightIndexInfo> makVrv::DtOsgLightingComponent::CameraToTileLightIndexMapInfoMap
protected

Constructor & Destructor Documentation

makVrv::DtOsgLightingComponent::DtOsgLightingComponent ( DtDe de)

CTOR.

virtual makVrv::DtOsgLightingComponent::~DtOsgLightingComponent ( )
virtual

DTOR.

makVrv::DtOsgLightingComponent::DtOsgLightingComponent ( )
privatedelete

private default constructor. not allowed.

makVrv::DtOsgLightingComponent::DtOsgLightingComponent ( const DtOsgLightingComponent )
privatedelete

prevent copy-construction

Member Function Documentation

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

prevent assignment

virtual void makVrv::DtOsgLightingComponent::update ( const VectorLights &  lights,
const osg::State &  state,
const osg::Camera *  camera 
)
virtual

Update the lighting uniforms with new light data.

virtual const Vector2_uint32& makVrv::DtOsgLightingComponent::tileSize ( void  ) const
virtual

get the tile size

virtual const Vector2_uint32& makVrv::DtOsgLightingComponent::gridMaxDims ( void  ) const
virtual

get the grid max dimensions

virtual void makVrv::DtOsgLightingComponent::updateLightSourceIndexBufferHandle ( const osg::Camera *  camera,
DtGlBuffer handle,
int  maxNumLightSources 
)
virtual

add/update/remove a light source index buffer handle/size entry in the map

virtual osg::Uniform* makVrv::DtOsgLightingComponent::getEnableLightingUniform ( ) const
virtual

Gets the uniform that toggles lighting.

virtual void makVrv::DtOsgLightingComponent::setAmbientFactor ( float  ambientFactor)
virtual

Sets the ambient factor uniform.

virtual void makVrv::DtOsgLightingComponent::setUseGlobalAmbient ( bool  useGlobalAmbient)
virtual

Enables/Disables the usage of the material ambient and global ambient.

virtual void makVrv::DtOsgLightingComponent::setDiffuseFactor ( float  diffuseFactor)
virtual

Sets the difuse factor uniform.

virtual void makVrv::DtOsgLightingComponent::setUseGlobalDiffuse ( bool  useGlobalDiffuse)
virtual

Enables/Disables the usage of the material diffuse and global diffuse.

virtual void makVrv::DtOsgLightingComponent::setUseHDR ( bool  useHDR)
virtual

Enables/Disables HDR Lighting.

virtual void makVrv::DtOsgLightingComponent::slot_reloadShader ( )
virtual

reload the light source compute shaders

virtual void makVrv::DtOsgLightingComponent::setDirty ( bool  isDirty)
inlinevirtual

Sets dirty state for reinstallation.

virtual void makVrv::DtOsgLightingComponent::setEmissionFactor ( float  emissionFactor)
virtual

Sets the emission factor uniform.

virtual bool makVrv::DtOsgLightingComponent::dirty ( ) const
inlinevirtual

Checks if component needs to be re-installed.

virtual void makVrv::DtOsgLightingComponent::releaseGLObjects ( void  )
virtual
virtual bool makVrv::DtOsgLightingComponent::install ( osg::StateSet *  stateset)
virtual

Install this component on a state set.

Implements makVrv::DtOsgStateComponent.

virtual bool makVrv::DtOsgLightingComponent::uninstall ( osg::StateSet *  stateset)
virtual

Uninstall this component from a state set.

Implements makVrv::DtOsgStateComponent.

virtual bool makVrv::DtOsgLightingComponent::isInstalled ( void  ) const
virtual

checks whether its installed

virtual void makVrv::DtOsgLightingComponent::setComponentVisualizationMode ( int  mode)
virtual

set the component visualization mode

static int makVrv::DtOsgLightingComponent::textureStartOffset ( void  )
static
virtual void makVrv::DtOsgLightingComponent::setLightPointScale ( double  scale)
protectedvirtual
virtual void makVrv::DtOsgLightingComponent::setDynamicLightScale ( double  scale)
protectedvirtual
virtual void makVrv::DtOsgLightingComponent::setEmissiveTextureScale ( double  scale)
protectedvirtual
virtual void makVrv::DtOsgLightingComponent::setSpecularScale ( double  scale)
protectedvirtual
virtual void makVrv::DtOsgLightingComponent::setShininessScale ( double  scale)
protectedvirtual
virtual osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::createUniform ( const std::string &  name,
osg::Uniform::Type  type,
int  count = 1 
)
protectedvirtual
virtual void makVrv::DtOsgLightingComponent::packLights ( const osg::Matrixd &  normalMatrix,
const VectorLights &  lights,
const osg::State &  state 
)
protectedvirtual
virtual void makVrv::DtOsgLightingComponent::updateTextureLightDataGrid ( void  )
protectedvirtual
virtual void makVrv::DtOsgLightingComponent::updateTiledShadingData ( const VectorLights &  lights,
const osg::State &  state,
const osg::Camera *  camera 
)
protectedvirtual

run the compute shaders in order to update the per camera lighting data and bin the lights in screenspace.

virtual void makVrv::DtOsgLightingComponent::updateTileLightIndexList ( const std::vector< Matrix4_64 > &  projectionMatrix,
const std::vector< Vector3_64 > &  vWorldEye,
const std::vector< Vector3_64 > &  vWorldCenter,
const std::vector< Vector3_64 > &  vWorldUp,
const Vector2_uint32 viewportSize,
const osg::Camera *  camera 
)
protectedvirtual

Updates the per-light-grid index lists.

virtual void makVrv::DtOsgLightingComponent::initializeColorRampTexture ( )
protectedvirtual

Updates the offsets and counts into the index grid.

virtual int makVrv::DtOsgLightingComponent::lightGridSize ( )
protectedvirtual

Returns the number of lights in the light grid.

virtual int makVrv::DtOsgLightingComponent::maxUboSize ( )
protectedvirtual

Returns the maximum UBO size that we'll use for a light UBO.

Member Data Documentation

osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myEnableLightingUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myLightingOffClampUniform
protected
std::vector< osg::ref_ptr<osg::Uniform> > makVrv::DtOsgLightingComponent::myUniforms
protected
DtLightData* makVrv::DtOsgLightingComponent::myLightGrid
protected
std::array<DtGlBuffer*, DtBindingManager::theLightBlockCount> makVrv::DtOsgLightingComponent::myLightUBO
protected
DtTileSpaceLightGrid* makVrv::DtOsgLightingComponent::myTileSpaceLightGrid
protected
DtGlBuffer* makVrv::DtOsgLightingComponent::myTileLightIndexListSsbo
protected

Holds a set of indexes, one per light tile.

This can get big, so cannot fit in a UBO.

DtGlBuffer* makVrv::DtOsgLightingComponent::myTileLightIndexListSsboPreCompute
protected
DtGlBuffer* makVrv::DtOsgLightingComponent::myTileLightIntersectionDataSsbo
protected
DtGlBuffer* makVrv::DtOsgLightingComponent::myTileLightIndexBuffersInfoSsbo
protected
CameraToTileLightIndexMapInfoMap makVrv::DtOsgLightingComponent::myCameraToTileLightIndexMapInfoMap
protected
DtGlSimpleTexture* makVrv::DtOsgLightingComponent::myColorRampTexture
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myColorRampTextureUniform
protected
osg::ref_ptr<TextureApplyAttribute> makVrv::DtOsgLightingComponent::myTextureApplyAttribute
protected
osg::ref_ptr<DtUniformBufferObjectApplyAttribute> makVrv::DtOsgLightingComponent::myUniformBufferObjectApplyAttribute
protected
osg::ref_ptr<DtShaderStorageBufferApplyAttribute> makVrv::DtOsgLightingComponent::myShaderStorageBufferApplyAttribute
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myViewportSizeUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myLightGridTileDimUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myLightGridMaxDimUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myLightPerViewOffsetUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myAmbientFactorUniform
protected
bool makVrv::DtOsgLightingComponent::myUseGlobalAmbient
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myUseGlobalAmbientUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myDiffuseFactorUniform
protected
bool makVrv::DtOsgLightingComponent::myUseGlobalDiffuse
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myUseGlobalDiffuseUniform
protected
bool makVrv::DtOsgLightingComponent::myUseHDR
protected
bool makVrv::DtOsgLightingComponent::myDirty
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myEmissionFactorUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myTransmittanceFactorUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myModelTransmittanceUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myLightPointScaleUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myDynamicLightScaleUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myEmissiveTextureScaleUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::mySpecularScaleUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myShininessScaleUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myUpVectorUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myBDRFLutUniform
protected
osg::ref_ptr<osg::Texture2D> makVrv::DtOsgLightingComponent::myBDRFLutTexture
protected
osg::ref_ptr<osg::Image> makVrv::DtOsgLightingComponent::myBrdfLutImage
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myComponentDebugUniform
protected
osg::ref_ptr<osg::Uniform> makVrv::DtOsgLightingComponent::myModelTypeDefaultUniform
protected
VectorLights makVrv::DtOsgLightingComponent::myViewSpaceLightsScratchPad
protected
bool makVrv::DtOsgLightingComponent::myIsInstalled
protected
DtSignalConnectionManager makVrv::DtOsgLightingComponent::myConnections
protected
bool makVrv::DtOsgLightingComponent::bColorRampTextureWasTried
staticprotected
GLint makVrv::DtOsgLightingComponent::myMaxUboSizeInBytes
protected
int makVrv::DtOsgLightingComponent::myLightGridSize
protected
const DtBindingManager& makVrv::DtOsgLightingComponent::myBindingManager
protected
DtLightComputeProgram* makVrv::DtOsgLightingComponent::myLightComputeProgram
protected
const float makVrv::DtOsgLightingComponent::theLightPointHdrScalar
staticprotected
const float makVrv::DtOsgLightingComponent::theDynamicLightHdrScalar
staticprotected
const float makVrv::DtOsgLightingComponent::theEmissiveTextureHdrScalar
staticprotected
osg::ref_ptr<osg::Texture> makVrv::DtOsgLightingComponent::myDebugTexture
protected

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

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)