VR-Forces 5.0.3 Developer's Guide
 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 | Friends
makVrv::DtOsgLightingComponent Class Reference

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.

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

Classes

struct  TileLightIndexInfo
 

Public Member Functions

 DtOsgLightingComponent (DtDe &de)
 
virtual ~DtOsgLightingComponent ()
 
virtual void update (const VectorLights &lights, const osg::State &state, const osg::Camera *camera)
 
virtual const Vector2_uint32tileSize (void) const
 
virtual const Vector2_uint32gridMaxDims (void) const
 
virtual void updateLightSourceIndexBufferHandle (const osg::Camera *camera, DtGlBuffer *handle, int maxNumLightSources)
 
virtual osg::Uniform * getEnableLightingUniform () const
 
virtual void setAmbientFactor (float ambientFactor)
 
virtual void setUseGlobalAmbient (bool useGlobalAmbient)
 
virtual void setDiffuseFactor (float diffuseFactor)
 
virtual void setUseGlobalDiffuse (bool useGlobalDiffuse)
 
virtual void setUseHDR (bool useHDR)
 
virtual void slot_reloadShader ()
 
virtual void setDirty (bool isDirty)
 
virtual void setEmissionFactor (float emissionFactor)
 
virtual bool dirty () const
 
virtual void releaseGLObjects (void)
 
virtual bool install (osg::StateSet *stateset)
 
virtual bool uninstall (osg::StateSet *stateset)
 
virtual bool isInstalled (void) const
 
virtual void setComponentVisualizationMode (int mode)
 
virtual const
DtLightingComponentShaderConstants
shaderConstants (void) const
 
virtual
DtLightingComponentShaderConstants
shaderConstants (void)
 
- Public Member Functions inherited from makVrv::DtOsgStateComponent
 DtOsgStateComponent (DtDe &de)
 

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)
 
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)
 
virtual void initializeColorRampTexture ()
 
virtual int lightGridSize ()
 
virtual int maxUboSize ()
 
virtual void setUpDebugTextureComponentMode (void)
 
virtual std::string findDebugTexturePath (void) const
 
- Protected Member Functions inherited from makVrv::DtOsgStateComponent
virtual ~DtOsgStateComponent ()
 
virtual const std::string & loadShaderSource (const std::string &strFileName) const
 

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
 
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
 
DtGlBuffermyGpuShaderUbo = nullptr
 
int myGpuShaderUboBinding
 
DtLightingComponentShaderConstantsmyShaderConstants = nullptr
 
DtOsgLightingComponentUboCallbackmyUboCallback = nullptr
 
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 > myUpVectorUniform
 
osg::ref_ptr< osg::Uniform > myBDRFLutUniform
 
osg::ref_ptr< osg::Texture2D > myBDRFLutTexture
 
osg::ref_ptr< osg::Image > myBrdfLutImage
 
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
 
 DtOsgLightingComponent (const DtOsgLightingComponent &)=delete
 
DtOsgLightingComponentoperator= (const DtOsgLightingComponent &)=delete
 

Friends

class DtOsgLightingComponentUboCallback
 

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

virtual const DtLightingComponentShaderConstants* makVrv::DtOsgLightingComponent::shaderConstants ( void  ) const
virtual

get the shader constants

virtual DtLightingComponentShaderConstants* makVrv::DtOsgLightingComponent::shaderConstants ( void  )
virtual

get the shader constants, non const

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.

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

set up the debug texture mode

virtual std::string makVrv::DtOsgLightingComponent::findDebugTexturePath ( void  ) const
protectedvirtual

find the path of the debug texture

Friends And Related Function Documentation

friend class DtOsgLightingComponentUboCallback
friend

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
DtGlBuffer* makVrv::DtOsgLightingComponent::myGpuShaderUbo = nullptr
protected
int makVrv::DtOsgLightingComponent::myGpuShaderUboBinding
protected
DtLightingComponentShaderConstants* makVrv::DtOsgLightingComponent::myShaderConstants = nullptr
protected
DtOsgLightingComponentUboCallback* makVrv::DtOsgLightingComponent::myUboCallback = nullptr
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::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::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 Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)