VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgLightingComponent.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2023 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
17 
19 
21 #include <vrvMath/DtVector4.h>
22 
24 
26 
27 #include <osg/Uniform>
28 
29 #include <vector>
30 #include <unordered_map>
31 #include <array>
32 
33 #include <tbb/atomic.h>
34 
35 namespace osg
36 {
37  class Matrixd;
38 }
39 
40 namespace makVrv
41 {
42  class DtLight;
43  class DtGlBuffer;
44  class DtGlTextureBufferObject;
45  class DtDe;
46 
47  class DtThreadCameraStreamDataManager;
48 
49  class DtLightingComponentShaderConstants;
50 
58  {
59  public:
62 
64  virtual ~DtOsgLightingComponent();
65  private:
67  DtOsgLightingComponent() = delete;
68 
71 
73  DtOsgLightingComponent& operator=(const DtOsgLightingComponent&) = delete;
74 
75  public:
77  virtual void update(const std::vector<const DtLight*>& lights, const osg::State& state, const osg::Camera* camera);
78 
80  virtual void updateLightSourceIndexBufferHandle(const osg::Camera* camera, DtGlBuffer* handle, int maxNumLightSources, bool createIfNeeded);
81 
83  virtual void setDirty(bool isDirty) { myDirty = isDirty; }
84 
86  virtual bool dirty() const { return myDirty; }
87 
88  // DtOsgStateComponent interface
90  virtual bool install(osg::StateSet* stateset);
91 
93  virtual bool uninstall(osg::StateSet* stateset);
94 
96  virtual bool isInstalled(void) const;
97 
99  virtual const DtLightingComponentShaderConstants* shaderConstants(const osg::Camera* camera) const;
100 
102  virtual DtLightingComponentShaderConstants* shaderConstants(const osg::Camera* camera);
103 
104  virtual void releaseGLObjects(void);
105 
107  virtual void slot_reloadShader();
108 
109  protected:
110  virtual osg::ref_ptr<osg::Uniform> createUniform(const std::string& name, osg::Uniform::Type type, int count = 1);
111 
113  virtual void bindRenderPassBuffers(const osg::State& state);
114 
116  virtual void slot_componentVisualizationModeChanged(int mode);
117 
118  virtual void slot_paramsChanged(void);
119  protected:
122 
123  std::vector< osg::ref_ptr<osg::Uniform> > myUniforms;
124 
127 
130 
132 
133  bool myDirty;
134 
136 
138 
140 
142 
143 
146  };
147 
150 
152  template <>
153  inline const char* creatorTypeName<DtOsgLightingComponent>(void) { return "DtOsgLightingComponentCreator"; }
154 }
Contains the DtLightingComponentStateAttribute class.
std::vector< osg::ref_ptr< osg::Uniform > > myUniforms
Definition: DtOsgLightingComponent.h:123
Manager for DtThreadCameraStreamData Holds them as cameras come in. Deletes them as cameras go out (v...
Definition: DtThreadCameraStreamDataManager.h:86
virtual void setDirty(bool isDirty)
Sets dirty state for reinstallation.
Definition: DtOsgLightingComponent.h:83
DtOsgLightingComponentTcsUserDataCreator & myUserDataCreator
Definition: DtOsgLightingComponent.h:145
Definition: DtLightingComponentShaderConstants.h:28
osg::ref_ptr< osg::Uniform > myEnableLightingUniform
Definition: DtOsgLightingComponent.h:120
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
osg::ref_ptr< osg::Uniform > myAmbientFactorUniform
Definition: DtOsgLightingComponent.h:125
osg::ref_ptr< osg::Uniform > myDiffuseFactorUniform
Definition: DtOsgLightingComponent.h:128
osg::ref_ptr< DtLightingComponentStateAttribute > myLightingComponentStateAttribute
Definition: DtOsgLightingComponent.h:141
4 dimensional vector
bool myDirty
Definition: DtOsgLightingComponent.h:133
const char * creatorTypeName< DtOsgLightingComponent >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtOsgLightingComponent.h:153
osg::ref_ptr< osg::Uniform > myUseGlobalDiffuseUniform
Definition: DtOsgLightingComponent.h:129
osg::ref_ptr< osg::Uniform > myLightingOffClampUniform
Definition: DtOsgLightingComponent.h:121
DtSignalConnectionManager myConnections
Definition: DtOsgLightingComponent.h:137
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
DtThreadCameraStreamDataManager & myTcsDataManager
Definition: DtOsgLightingComponent.h:144
osg::ref_ptr< osg::Uniform > myModelTypeDefaultUniform
Definition: DtOsgLightingComponent.h:131
Light class.
osg::ref_ptr< osg::Uniform > myUseGlobalAmbientUniform
Definition: DtOsgLightingComponent.h:126
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
bool myIsInstalled
Definition: DtOsgLightingComponent.h:135
Contains makVrv::DtLightComputeProgram class.
A generic OpenGL buffer. This can be: -&gt; a vertex buffer -&gt; an index buffer -&gt; a shader storage buffe...
Definition: DtGlBuffer.h:29
DtVirtualBaseClassCreator< DtOsgLightingComponent > DtOsgLightingComponentCreator
creator
Definition: DtOsgLightingComponent.h:149
Base class to provide boost signal/slot management.
Base class for components that affect the state on a subset of the scene graph, injecting state...
Definition: DtOsgStateComponent.h:34
const char int mode
Definition: ioapi.h:38
Contains the DtOsgLightingComponentTcsUserData class.
Manage buffer object binding state, via glBindBufferBase.
Definition: DtLightingComponentStateAttribute.h:34
Contains DLL export macros.
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:72
Contains makVrv::DtOsgStateComponent class.
virtual bool dirty() const
Checks if component needs to be re-installed.
Definition: DtOsgLightingComponent.h:86
State component that injects lighting shaders and uniforms into a state set. It also has a DtLightCom...
Definition: DtOsgLightingComponent.h:57

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)