27 #include <osg/Uniform>
28 #include <osg/Texture2D>
31 #include <unordered_map>
34 #include <tbb/atomic.h>
45 class DtTileSpaceLightGrid;
46 class DtGlSimpleTexture;
48 class DtGlTextureBufferObject;
51 class TextureApplyAttribute;
52 class TextureBufferObjectApplyAttribute;
53 class DtUniformBufferObjectApplyAttribute;
54 class DtShaderStorageBufferApplyAttribute;
82 virtual void update(
const VectorLights& lights,
const osg::State& state,
const osg::Camera* camera);
91 virtual void updateLightSourceIndexBufferHandle(
const osg::Camera* camera,
DtGlBuffer* handle,
int maxNumLightSources);
94 virtual osg::Uniform* getEnableLightingUniform()
const;
97 virtual void setAmbientFactor(
float ambientFactor);
100 virtual void setUseGlobalAmbient(
bool useGlobalAmbient);
103 virtual void setDiffuseFactor(
float diffuseFactor);
106 virtual void setUseGlobalDiffuse(
bool useGlobalDiffuse);
109 virtual void setUseHDR(
bool useHDR);
112 virtual void slot_reloadShader();
115 virtual void setDirty(
bool isDirty) { myDirty = isDirty; }
118 virtual void setEmissionFactor(
float emissionFactor);
121 virtual bool dirty()
const {
return myDirty; }
123 virtual void releaseGLObjects(
void);
127 virtual bool install(osg::StateSet* stateset);
130 virtual bool uninstall(osg::StateSet* stateset);
133 virtual bool isInstalled(
void)
const;
136 virtual void setComponentVisualizationMode(
int mode);
138 static int textureStartOffset(
void);
141 virtual void setLightPointScale(
double scale);
142 virtual void setDynamicLightScale(
double scale);
143 virtual void setEmissiveTextureScale(
double scale);
144 virtual void setSpecularScale(
double scale);
145 virtual void setShininessScale(
double scale);
149 virtual void packLights(
const osg::Matrixd& normalMatrix,
const VectorLights& lights,
const osg::State& state);
150 virtual void updateTextureLightDataGrid(
void);
152 virtual void updateTiledShadingData(
const VectorLights& lights,
const osg::State& state,
const osg::Camera* camera);
155 virtual void updateTileLightIndexList(
const std::vector<Matrix4_64>& projectionMatrix
156 ,
const std::vector<Vector3_64>& vWorldEye
157 ,
const std::vector<Vector3_64>& vWorldCenter
158 ,
const std::vector<Vector3_64>& vWorldUp
160 ,
const osg::Camera* camera);
162 virtual void initializeColorRampTexture( );
165 virtual int lightGridSize();
167 virtual int maxUboSize();
179 std::array<DtGlBuffer*, DtBindingManager::theLightBlockCount>
myLightUBO;
197 : myBufferToLightIndexMap()
198 , myBufferChunkCount(0)
Contains the DtOsgTextureBufferObjectApplyAttribute class.
osg::ref_ptr< osg::Uniform > myLightPointScaleUniform
Definition: DtOsgLightingComponent.h:240
std::vector< osg::ref_ptr< osg::Uniform > > myUniforms
Definition: DtOsgLightingComponent.h:174
Helper class to pack lights into a buffer/texture.
Definition: DtLightData.h:41
virtual void setDirty(bool isDirty)
Sets dirty state for reinstallation.
Definition: DtOsgLightingComponent.h:115
bool myUseGlobalAmbient
Definition: DtOsgLightingComponent.h:228
osg::ref_ptr< osg::Uniform > myDynamicLightScaleUniform
Definition: DtOsgLightingComponent.h:241
DtGlSimpleTexture * myColorRampTexture
Definition: DtOsgLightingComponent.h:214
osg::ref_ptr< osg::Uniform > myEnableLightingUniform
Definition: DtOsgLightingComponent.h:171
DtLightData * myLightGrid
Definition: DtOsgLightingComponent.h:177
CameraToTileLightIndexMapInfoMap myCameraToTileLightIndexMapInfoMap
Definition: DtOsgLightingComponent.h:212
osg::ref_ptr< osg::Uniform > myBDRFLutUniform
Definition: DtOsgLightingComponent.h:247
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
bool myUseHDR
Definition: DtOsgLightingComponent.h:233
osg::ref_ptr< osg::Uniform > mySpecularScaleUniform
Definition: DtOsgLightingComponent.h:243
osg::ref_ptr< osg::Uniform > myLightGridTileDimUniform
Definition: DtOsgLightingComponent.h:223
Wrapper for OpenGL Texture.
Definition: DtGlSimpleTexture.h:35
osg::ref_ptr< osg::Uniform > myEmissionFactorUniform
Definition: DtOsgLightingComponent.h:235
const DtBindingManager & myBindingManager
Definition: DtOsgLightingComponent.h:266
Contains the vrvOsg::DtBindingManager class.
Contains the DtOsgTextureApplyAttribute class.
osg::ref_ptr< osg::Uniform > myAmbientFactorUniform
Definition: DtOsgLightingComponent.h:227
osg::ref_ptr< osg::Uniform > myDiffuseFactorUniform
Definition: DtOsgLightingComponent.h:230
osg::ref_ptr< osg::Uniform > myLightPerViewOffsetUniform
Definition: DtOsgLightingComponent.h:225
struct for holding information about a camera's tile light index map
Definition: DtOsgLightingComponent.h:193
bool myDirty
Definition: DtOsgLightingComponent.h:234
const char * creatorTypeName< DtOsgLightingComponent >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtOsgLightingComponent.h:284
osg::ref_ptr< osg::Uniform > myUseGlobalDiffuseUniform
Definition: DtOsgLightingComponent.h:232
osg::ref_ptr< osg::Uniform > myModelTransmittanceUniform
Definition: DtOsgLightingComponent.h:238
TileLightIndexInfo()
Definition: DtOsgLightingComponent.h:196
osg::ref_ptr< osg::Image > myBrdfLutImage
Definition: DtOsgLightingComponent.h:249
osg::ref_ptr< osg::Uniform > myLightingOffClampUniform
Definition: DtOsgLightingComponent.h:172
DtSignalConnectionManager myConnections
Definition: DtOsgLightingComponent.h:259
static const float theEmissiveTextureHdrScalar
Definition: DtOsgLightingComponent.h:273
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
Manage interface block bindings.
Definition: DtBindingManager.h:43
osg::ref_ptr< osg::Uniform > myViewportSizeUniform
Definition: DtOsgLightingComponent.h:221
osg::ref_ptr< osg::Uniform > myEmissiveTextureScaleUniform
Definition: DtOsgLightingComponent.h:242
int myBufferChunkCount
Definition: DtOsgLightingComponent.h:206
osg::ref_ptr< DtUniformBufferObjectApplyAttribute > myUniformBufferObjectApplyAttribute
Definition: DtOsgLightingComponent.h:218
osg::ref_ptr< osg::Uniform > myModelTypeDefaultUniform
Definition: DtOsgLightingComponent.h:253
osg::ref_ptr< osg::Texture2D > myBDRFLutTexture
Definition: DtOsgLightingComponent.h:248
osg::ref_ptr< osg::Uniform > myUseGlobalAmbientUniform
Definition: DtOsgLightingComponent.h:229
DtGlBuffer * myTileLightIntersectionDataSsbo
Definition: DtOsgLightingComponent.h:187
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
osg::ref_ptr< osg::Uniform > myTransmittanceFactorUniform
Definition: DtOsgLightingComponent.h:237
osg::ref_ptr< osg::Texture > myDebugTexture
Definition: DtOsgLightingComponent.h:275
bool myIsInstalled
Definition: DtOsgLightingComponent.h:257
std::unordered_map< DtGlBuffer *, int > BufferToLightIndexMap
Definition: DtOsgLightingComponent.h:190
osg::ref_ptr< osg::Uniform > myUpVectorUniform
Definition: DtOsgLightingComponent.h:246
static const float theDynamicLightHdrScalar
Definition: DtOsgLightingComponent.h:272
DtLightComputeProgram * myLightComputeProgram
Definition: DtOsgLightingComponent.h:268
Contains makVrv::DtLightComputeProgram class.
osg::ref_ptr< osg::Uniform > myColorRampTextureUniform
Definition: DtOsgLightingComponent.h:215
Class doing all the heavy lifting in regards of forward+ lighting.
Definition: DtTileSpaceLightGrid.h:40
static const float theLightPointHdrScalar
Definition: DtOsgLightingComponent.h:271
bool myUseGlobalDiffuse
Definition: DtOsgLightingComponent.h:231
int myLightGridSize
Definition: DtOsgLightingComponent.h:264
A generic OpenGL buffer.
Definition: DtGlBuffer.h:27
DtVirtualBaseClassCreator< DtOsgLightingComponent > DtOsgLightingComponentCreator
creator
Definition: DtOsgLightingComponent.h:280
osg::ref_ptr< DtShaderStorageBufferApplyAttribute > myShaderStorageBufferApplyAttribute
Definition: DtOsgLightingComponent.h:219
osg::ref_ptr< osg::Uniform > myShininessScaleUniform
Definition: DtOsgLightingComponent.h:244
VectorLights myViewSpaceLightsScratchPad
Definition: DtOsgLightingComponent.h:255
Base class to provide boost signal/slot management.
osg::ref_ptr< TextureApplyAttribute > myTextureApplyAttribute
Definition: DtOsgLightingComponent.h:217
Base class for components that affect the state on a subset of the scene graph, injecting state...
Definition: DtOsgStateComponent.h:34
int myTotalCount
Definition: DtOsgLightingComponent.h:207
const char int mode
Definition: ioapi.h:38
std::array< DtGlBuffer *, DtBindingManager::theLightBlockCount > myLightUBO
Definition: DtOsgLightingComponent.h:179
Contains DLL export macros.
DtTileSpaceLightGrid * myTileSpaceLightGrid
Definition: DtOsgLightingComponent.h:181
DtGlBuffer * myTileLightIndexBuffersInfoSsbo
Definition: DtOsgLightingComponent.h:188
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
Contains makVrv::DtOsgStateComponent class.
DtGlBuffer * myTileLightIndexListSsboPreCompute
Definition: DtOsgLightingComponent.h:186
DtGlBuffer * myTileLightIndexListSsbo
Holds a set of indexes, one per light tile.
Definition: DtOsgLightingComponent.h:185
osg::ref_ptr< osg::Uniform > myComponentDebugUniform
Definition: DtOsgLightingComponent.h:251
virtual bool dirty() const
Checks if component needs to be re-installed.
Definition: DtOsgLightingComponent.h:121
std::unordered_map< const osg::Camera *, TileLightIndexInfo > CameraToTileLightIndexMapInfoMap
Definition: DtOsgLightingComponent.h:211
osg::ref_ptr< osg::Uniform > myLightGridMaxDimUniform
Definition: DtOsgLightingComponent.h:224
BufferToLightIndexMap myBufferToLightIndexMap
Definition: DtOsgLightingComponent.h:205
static bool bColorRampTextureWasTried
Definition: DtOsgLightingComponent.h:261
State component that injects lighting shaders and uniforms into a state set.
Definition: DtOsgLightingComponent.h:62
Class that encapsulates the 2 pass (setup, sort) computation of lights affecting the screen space til...
Definition: DtLightComputeProgram.h:46
GLint myMaxUboSizeInBytes
Definition: DtOsgLightingComponent.h:263