18 #include <osg/observer_ptr>
22 #include <matrix/vlVector.h>
27 #include <boost/thread.hpp>
28 #include <unordered_map>
42 class DtOsgLightsObserver;
57 static const int theMwirLightSourceSensorMask = 0b0100;
58 static const int theLwirLightSourceSensorMask = 0b1000;
59 static const int theIrLightSourceSensorMask = theMwirLightSourceSensorMask | theLwirLightSourceSensorMask;
60 static const int theNvgLightSourceSensorMask = 0b0010;
61 static const int theVisualLightSourceSensorMask = 0b0001;
62 static const int theDefaultLightSourceSensorMask = theNvgLightSourceSensorMask | theVisualLightSourceSensorMask;
85 virtual void initialize();
89 virtual void attachToStateSet(osg::StateSet* stateSet);
92 virtual void setPerPixelLightingEnabled(
bool enabled);
95 virtual bool perPixelLightingEnabled()
const;
101 virtual void setReservedID(
int id);
104 virtual int reservedID()
const;
108 virtual void cullReset();
111 virtual bool registerLight(
const osg::LightSource* light,
const osg::NodePath& nodePath,
const osg::Matrixd& modelingMatrix,
bool globalLights);
115 virtual DtLight* createDtLight(
const osg::Light* osgLight);
118 virtual void convertOsgLightToDtLight(
const osg::LightSource& lightSource,
DtLight* pDtLight,
const osg::Matrixd& modelingMatrix);
121 virtual unsigned int sensorMaskFromLightSource(
const osg::LightSource& lightSource)
const;
124 virtual void deregisterLight(
const osg::LightSource* light);
127 virtual void getWorldPositionAndDirection(
const osg::LightSource& lightSource,
const osg::Matrixd& modelingMatrix, osg::Vec3d& vWorldPos, osg::Vec3d& vWorldDir)
const;
130 virtual void update(osg::State& state,
DtDe& de,
const osg::Camera* camera);
133 virtual int getTextureStartOffset(
void)
const;
142 virtual void releaseGLObjects(
void);
145 virtual unsigned int getOrCreateLightSourceTypeId(
DtLight* pDtLight);
148 virtual unsigned int getOrCreateLightSourceTypeId(
const osg::LightSource& lightSource);
152 virtual unsigned int getOrCreateDynamicLightSourceTypeId(
const DtLight* pDtLight);
155 virtual void deleteDynamicLightSourceTypeId(
const DtLight* pDtLight);
162 virtual void updateLightSourceType(
unsigned int id,
const DtLight* light);
175 static const std::string& theClassName();
178 static LightType lightType(
const osg::Light* light);
182 virtual void updateLightOnOffStatus(
const VectorLights& lights);
187 virtual void updateFixedFunctionLights(
const osg::State& state);
193 virtual void updateShaderBasedLights(
const osg::State& state,
const VectorLights& lights,
const osg::Camera* camera);
195 virtual const VectorLights& computeFrustumLights(
const osg::State &state,
const osg::Camera* camera);
197 virtual void proccessLightPath(
DtLight* inLight,
const osg::NodePath& nodePath);
199 virtual void configurePerPixelLighting(osg::StateSet*);
201 virtual void slot_reloadShader();
203 virtual bool existsInLightManager(
const DtLight* light)
const;
DtLightManager * myLightManager
Definition: DtOsgLightManager.h:220
LightManager class which allows creation/deletion of lights.
Definition: DtLightManager.h:30
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
DtDe & myDe
Definition: DtOsgLightManager.h:207
MapLightSourceHashToLights myMapLightSourceHashToLights
Definition: DtOsgLightManager.h:225
DtOsgLightsObserver * myOsgLightsObserver
Definition: DtOsgLightManager.h:227
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
bool myPerPixelLightingEnabled
Definition: DtOsgLightManager.h:212
An OSG implementation of the sky.
Definition: DtOsgSkyObject.h:28
bool myInitialized
Definition: DtOsgLightManager.h:208
osg::observer_ptr< osg::StateSet > myStateSet
Definition: DtOsgLightManager.h:217
MapLightSourceTypeToLightID myLightSourceTypeMap
Definition: DtOsgLightManager.h:230
LightType
Definition: DtLight.h:30
VectorLights myActiveLights
Definition: DtOsgLightManager.h:218
DtOsgLightManager receives LightSource nodes from the DtOsgCullVisitor, and collects them all here wh...
Definition: DtOsgLightManager.h:51
int myReservedID
Definition: DtOsgLightManager.h:210
bool myDebugCallbackInitialized
Definition: DtOsgLightManager.h:209
boost::mutex myMutableLightSourceTypeMutex
Definition: DtOsgLightManager.h:234
LightReusableVector myLightSourceTypeLightVector
Definition: DtOsgLightManager.h:231
Contains the DtOsgLightingComponent class.
Contains makVrv::DtReusableMemoryVector class.
Class for generic lights This holds per-light data such as range, attenuation factors, colors, etc.
Definition: DtLight.h:48
std::unordered_map< size_t, LightSourceAndLight > MapLightSourceHashToLights
Definition: DtOsgLightManager.h:224
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
std::map< size_t, unsigned int > MapLightSourceTypeToLightID
Definition: DtOsgLightManager.h:229
Contains makVrv::DtOsgShaderManager class.
osg::ref_ptr< DtOsgLightingComponent > myLightingComponent
Definition: DtOsgLightManager.h:214
std::pair< const osg::LightSource *, const makVrv::DtLight * > LightSourceAndLight
Definition: DtOsgLightManager.h:222
State component that injects lighting shaders and uniforms into a state set. It also has a DtLightCom...
Definition: DtOsgLightingComponent.h:68