29 #include <osg/Uniform>
30 #include <osg/Texture2D>
33 #include <unordered_map>
36 #include <tbb/atomic.h>
47 class DtTileSpaceLightGrid;
48 class DtGlSimpleTexture;
50 class DtGlTextureBufferObject;
53 class TextureApplyAttribute;
54 class TextureBufferObjectApplyAttribute;
55 class DtUniformBufferObjectApplyAttribute;
56 class DtShaderStorageBufferApplyAttribute;
58 class DtLightingComponentShaderConstants;
60 class DtOsgLightingComponentUboCallback;
88 virtual void update(
const VectorLights& lights,
const osg::State& state,
const osg::Camera* camera);
97 virtual void updateLightSourceIndexBufferHandle(
const osg::Camera* camera,
DtGlBuffer* handle,
int maxNumLightSources);
100 virtual osg::Uniform* getEnableLightingUniform()
const;
103 virtual void setAmbientFactor(
float ambientFactor);
106 virtual void setUseGlobalAmbient(
bool useGlobalAmbient);
109 virtual void setDiffuseFactor(
float diffuseFactor);
112 virtual void setUseGlobalDiffuse(
bool useGlobalDiffuse);
115 virtual void setUseHDR(
bool useHDR);
118 virtual void slot_reloadShader();
121 virtual void setDirty(
bool isDirty) { myDirty = isDirty; }
124 virtual void setEmissionFactor(
float emissionFactor);
127 virtual bool dirty()
const {
return myDirty; }
129 virtual void releaseGLObjects(
void);
133 virtual bool install(osg::StateSet* stateset);
136 virtual bool uninstall(osg::StateSet* stateset);
139 virtual bool isInstalled(
void)
const;
142 virtual void setComponentVisualizationMode(
int mode);
150 static int textureStartOffset(
void);
153 virtual void setLightPointScale(
double scale);
154 virtual void setDynamicLightScale(
double scale);
155 virtual void setEmissiveTextureScale(
double scale);
156 virtual void setSpecularScale(
double scale);
157 virtual void setShininessScale(
double scale);
161 virtual void packLights(
const osg::Matrixd& normalMatrix,
const VectorLights& lights,
const osg::State& state);
162 virtual void updateTextureLightDataGrid(
void);
164 virtual void updateTiledShadingData(
const VectorLights& lights,
const osg::State& state,
const osg::Camera* camera);
167 virtual void updateTileLightIndexList(
const std::vector<Matrix4_64>& projectionMatrix
168 ,
const std::vector<Vector3_64>& vWorldEye
169 ,
const std::vector<Vector3_64>& vWorldCenter
170 ,
const std::vector<Vector3_64>& vWorldUp
172 ,
const osg::Camera* camera);
174 virtual void initializeColorRampTexture( );
177 virtual int lightGridSize();
180 virtual int maxUboSize();
183 virtual void setUpDebugTextureComponentMode(
void);
186 virtual std::string findDebugTexturePath(
void)
const;
198 std::array<DtGlBuffer*, DtBindingManager::theLightBlockCount>
myLightUBO;
216 : myBufferToLightIndexMap()
217 , myBufferChunkCount(0)
244 friend class DtOsgLightingComponentUboCallback;
245 DtOsgLightingComponentUboCallback* myUboCallback =
nullptr;
Contains the DtOsgTextureBufferObjectApplyAttribute class.
std::vector< osg::ref_ptr< osg::Uniform > > myUniforms
Definition: DtOsgLightingComponent.h:193
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:121
bool myUseGlobalAmbient
Definition: DtOsgLightingComponent.h:248
DtGlSimpleTexture * myColorRampTexture
Definition: DtOsgLightingComponent.h:233
Definition: DtLightingComponentShaderConstants.h:28
osg::ref_ptr< osg::Uniform > myEnableLightingUniform
Definition: DtOsgLightingComponent.h:190
DtLightData * myLightGrid
Definition: DtOsgLightingComponent.h:196
CameraToTileLightIndexMapInfoMap myCameraToTileLightIndexMapInfoMap
Definition: DtOsgLightingComponent.h:231
osg::ref_ptr< osg::Uniform > myBDRFLutUniform
Definition: DtOsgLightingComponent.h:259
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
bool myUseHDR
Definition: DtOsgLightingComponent.h:255
Wrapper for OpenGL Texture.
Definition: DtGlSimpleTexture.h:35
Contains the DtBufferObjectApplyAttribute class.
const DtBindingManager & myBindingManager
Definition: DtOsgLightingComponent.h:276
Contains the vrvOsg::DtBindingManager class.
Contains the DtOsgTextureApplyAttribute class.
osg::ref_ptr< osg::Uniform > myAmbientFactorUniform
Definition: DtOsgLightingComponent.h:247
osg::ref_ptr< osg::Uniform > myDiffuseFactorUniform
Definition: DtOsgLightingComponent.h:251
struct for holding information about a camera's tile light index map
Definition: DtOsgLightingComponent.h:212
bool myDirty
Definition: DtOsgLightingComponent.h:256
const char * creatorTypeName< DtOsgLightingComponent >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtOsgLightingComponent.h:294
osg::ref_ptr< osg::Uniform > myUseGlobalDiffuseUniform
Definition: DtOsgLightingComponent.h:253
TileLightIndexInfo()
Definition: DtOsgLightingComponent.h:215
osg::ref_ptr< osg::Image > myBrdfLutImage
Definition: DtOsgLightingComponent.h:261
osg::ref_ptr< osg::Uniform > myLightingOffClampUniform
Definition: DtOsgLightingComponent.h:191
DtSignalConnectionManager myConnections
Definition: DtOsgLightingComponent.h:269
static const float theEmissiveTextureHdrScalar
Definition: DtOsgLightingComponent.h:283
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
Manage interface block bindings. This knowledge was previously distributed several places in the code...
Definition: DtBindingManager.h:43
int myBufferChunkCount
Definition: DtOsgLightingComponent.h:225
osg::ref_ptr< DtUniformBufferObjectApplyAttribute > myUniformBufferObjectApplyAttribute
Definition: DtOsgLightingComponent.h:237
osg::ref_ptr< osg::Uniform > myModelTypeDefaultUniform
Definition: DtOsgLightingComponent.h:263
osg::ref_ptr< osg::Texture2D > myBDRFLutTexture
Definition: DtOsgLightingComponent.h:260
osg::ref_ptr< osg::Uniform > myUseGlobalAmbientUniform
Definition: DtOsgLightingComponent.h:249
DtGlBuffer * myTileLightIntersectionDataSsbo
Definition: DtOsgLightingComponent.h:206
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
osg::ref_ptr< osg::Texture > myDebugTexture
Definition: DtOsgLightingComponent.h:285
bool myIsInstalled
Definition: DtOsgLightingComponent.h:267
std::unordered_map< DtGlBuffer *, int > BufferToLightIndexMap
Definition: DtOsgLightingComponent.h:209
osg::ref_ptr< osg::Uniform > myUpVectorUniform
Definition: DtOsgLightingComponent.h:258
static const float theDynamicLightHdrScalar
Definition: DtOsgLightingComponent.h:282
DtLightComputeProgram * myLightComputeProgram
Definition: DtOsgLightingComponent.h:278
Contains makVrv::DtLightComputeProgram class.
osg::ref_ptr< osg::Uniform > myColorRampTextureUniform
Definition: DtOsgLightingComponent.h:234
Class doing all the heavy lifting in regards of forward+ lighting.
Definition: DtTileSpaceLightGrid.h:40
static const float theLightPointHdrScalar
Definition: DtOsgLightingComponent.h:281
bool myUseGlobalDiffuse
Definition: DtOsgLightingComponent.h:252
int myLightGridSize
Definition: DtOsgLightingComponent.h:274
A generic OpenGL buffer. This can be: -> a vertex buffer -> an index buffer -> a shader storage buffe...
Definition: DtGlBuffer.h:29
DtVirtualBaseClassCreator< DtOsgLightingComponent > DtOsgLightingComponentCreator
creator
Definition: DtOsgLightingComponent.h:290
osg::ref_ptr< DtShaderStorageBufferApplyAttribute > myShaderStorageBufferApplyAttribute
Definition: DtOsgLightingComponent.h:238
VectorLights myViewSpaceLightsScratchPad
Definition: DtOsgLightingComponent.h:265
Base class to provide boost signal/slot management.
int myGpuShaderUboBinding
Definition: DtOsgLightingComponent.h:241
osg::ref_ptr< TextureApplyAttribute > myTextureApplyAttribute
Definition: DtOsgLightingComponent.h:236
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:226
const char int mode
Definition: ioapi.h:38
std::array< DtGlBuffer *, DtBindingManager::theLightBlockCount > myLightUBO
Definition: DtOsgLightingComponent.h:198
Contains DLL export macros.
DtTileSpaceLightGrid * myTileSpaceLightGrid
Definition: DtOsgLightingComponent.h:200
DtGlBuffer * myTileLightIndexBuffersInfoSsbo
Definition: DtOsgLightingComponent.h:207
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
Contains makVrv::DtOsgStateComponent class.
DtGlBuffer * myTileLightIndexListSsboPreCompute
Definition: DtOsgLightingComponent.h:205
DtGlBuffer * myTileLightIndexListSsbo
Holds a set of indexes, one per light tile. This can get big, so cannot fit in a UBO.
Definition: DtOsgLightingComponent.h:204
virtual bool dirty() const
Checks if component needs to be re-installed.
Definition: DtOsgLightingComponent.h:127
std::unordered_map< const osg::Camera *, TileLightIndexInfo > CameraToTileLightIndexMapInfoMap
Definition: DtOsgLightingComponent.h:230
BufferToLightIndexMap myBufferToLightIndexMap
Definition: DtOsgLightingComponent.h:224
static bool bColorRampTextureWasTried
Definition: DtOsgLightingComponent.h:271
State component that injects lighting shaders and uniforms into a state set. It also has a DtLightCom...
Definition: DtOsgLightingComponent.h:68
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:273