VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtOsgLightManager Class Reference

DtOsgLightManager receives LightSource nodes from the DtOsgCullVisitor, and collects them all here where they may by applied simultaneously at the same time.

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

Public Member Functions

virtual ~DtOsgLightManager ()
 
virtual void initialize ()
 
virtual void attachToStateSet (osg::StateSet *stateSet)
 
virtual void setPerPixelLightingEnabled (bool enabled)
 
virtual bool perPixelLightingEnabled () const
 
virtual DtLightManagerlightManager ()
 
virtual void setReservedID (int id)
 
virtual int reservedID () const
 
virtual bool registerLight (const osg::LightSource *light, const osg::NodePath &nodePath, const osg::Matrixd &modelingMatrix, bool globalLights, const osg::Camera *osgCamera)
 
virtual void deregisterLight (const osg::LightSource *light)
 
virtual void update (const osg::State &state, const osg::Camera *camera)
 
virtual void releaseGLObjects (void)
 
virtual unsigned int getOrCreateLightSourceTypeId (const osg::LightSource &lightSource)
 
virtual unsigned int getOrCreateDynamicLightSourceTypeId (const DtLight *pDtLight)
 
virtual void deleteDynamicLightSourceTypeId (const DtLight *pDtLight)
 
virtual LightReusableVector lightSourceTypeLightVector () const
 
virtual void updateLightSourceType (unsigned int id, const DtLight *light)
 
virtual const
DtOsgLightingComponent
lightingComponent () const
 
virtual DtOsgLightingComponentlightingComponent ()
 
- Public Member Functions inherited from makVrv::DtVirtualBaseClass
 DtVirtualBaseClass ()
 
virtual ~DtVirtualBaseClass ()
 

Static Public Member Functions

static DtOsgLightManagerinstance (DtDe &de)
 
static const std::string & theClassName ()
 

Static Public Attributes

static const int theMwirLightSourceSensorMask = 0b0100
 
static const int theLwirLightSourceSensorMask = 0b1000
 
static const int theIrLightSourceSensorMask = theMwirLightSourceSensorMask | theLwirLightSourceSensorMask
 
static const int theNvgLightSourceSensorMask = 0b0010
 
static const int theVisualLightSourceSensorMask = 0b0001
 
static const int theDefaultLightSourceSensorMask = theNvgLightSourceSensorMask | theVisualLightSourceSensorMask
 

Protected Types

typedef std::pair< const
osg::LightSource *, const
makVrv::DtLight * > 
LightSourceAndLight
 
typedef std::unordered_map
< size_t, LightSourceAndLight
MapLightSourceHashToLights
 
typedef std::map< size_t,
unsigned int
MapLightSourceTypeToLightID
 

Protected Member Functions

 DtOsgLightManager (DtDe &de)
 
virtual bool computeLightStatusForTime (const DtLight *pDtLight, float ambientLightValue) const
 
virtual void updateShaderBasedLights (const osg::State &state, const osg::Camera *camera, DtOsgLightManagerTcsUserData *tcsUserData)
 
virtual void computeFrustumLights (const osg::State &state, const osg::Camera *camera, DtOsgLightManagerTcsUserData *tcsUserData) const
 
virtual void computeActiveLights (DtOsgLightManagerTcsUserData *tcsUserData, const osg::Camera *camera) const
 
virtual void proccessLightPath (DtLight *inLight, const osg::NodePath &nodePath)
 
virtual void configurePerPixelLighting (osg::StateSet *)
 
virtual void slot_reloadShader ()
 
virtual bool existsInLightManager (const DtLight *light) const
 
virtual void convertOsgLightToDtLight (DtLight *pDtLight, const osg::LightSource &lightSource, const osg::Matrixd &modelingMatrix)
 
virtual void getWorldPositionAndDirection (const osg::LightSource &lightSource, const osg::Matrixd &modelingMatrix, osg::Vec3d &vWorldPos, osg::Vec3d &vWorldDir) const
 
virtual unsigned int getOrCreateLightSourceTypeId (const DtLight *pDtLight)
 
virtual unsigned int sensorMaskFromLightSource (const osg::LightSource &lightSource) const
 
virtual size_t getNodePathHashValue (const osg::NodePath &nodePath) const
 
virtual void printNodePath (const osg::NodePath &nodePath) const
 
virtual size_t computeHash (const DtLight *pDtLight) const
 
virtual LightType lightType (const osg::Light *light) const
 
virtual unsigned int getOrCreateLightSourceTypeId (const DtLight *pDtLight, size_t hash)
 
virtual void slot_preTick (void)
 

Protected Attributes

DtDemyDe
 
bool myInitialized
 
bool myDebugCallbackInitialized
 
int myReservedID
 
bool myPerPixelLightingEnabled
 
osg::ref_ptr
< DtOsgLightingComponent
myLightingComponent
 
osg::observer_ptr< osg::StateSet > myStateSet
 
DtLightManagermyLightManager
 
MapLightSourceHashToLights myMapLightSourceHashToLights
 
std::unordered_set< const
DtLight * > 
myLightsCreatedViaRegister
 
std::mutex myRegisterUnRegisterPathMutex
 
DtOsgLightsObservermyOsgLightsObserver
 
MapLightSourceTypeToLightID myLightSourceTypeMap
 
LightReusableVector myLightSourceTypeLightVector
 
boost::mutex myMutableLightSourceTypeMutex
 
DtThreadCameraStreamDataManagermyTcsDataManager
 
DtOsgLightManagerTcsUserDataCreatormyUserDataCreator
 
DtSignalConnectionManager myConnections
 

Private Member Functions

 DtOsgLightManager ()=delete
 
 DtOsgLightManager (const DtOsgLightManager &rhs)=delete
 
DtOsgLightManageroperator= (const DtOsgLightManager &rhs)=delete
 

Member Typedef Documentation

typedef std::pair<const osg::LightSource*, const makVrv::DtLight*> makVrv::DtOsgLightManager::LightSourceAndLight
protected
typedef std::unordered_map<size_t, LightSourceAndLight> makVrv::DtOsgLightManager::MapLightSourceHashToLights
protected

Constructor & Destructor Documentation

virtual makVrv::DtOsgLightManager::~DtOsgLightManager ( )
virtual

DTOR.

makVrv::DtOsgLightManager::DtOsgLightManager ( DtDe de)
protected

purposely protected

makVrv::DtOsgLightManager::DtOsgLightManager ( )
privatedelete

not allowed

makVrv::DtOsgLightManager::DtOsgLightManager ( const DtOsgLightManager rhs)
privatedelete

not allowed

Member Function Documentation

DtOsgLightManager& makVrv::DtOsgLightManager::operator= ( const DtOsgLightManager rhs)
privatedelete

not allowed

virtual void makVrv::DtOsgLightManager::initialize ( )
virtual

Initialize the manager, create member variables and connect signals etc.

virtual void makVrv::DtOsgLightManager::attachToStateSet ( osg::StateSet *  stateSet)
virtual

Attach the light manager to a particular OSG state set. Pass in NULL to detach.

virtual void makVrv::DtOsgLightManager::setPerPixelLightingEnabled ( bool  enabled)
virtual

Toggles global use of shader-based lighting effects.

virtual bool makVrv::DtOsgLightManager::perPixelLightingEnabled ( ) const
virtual

Retrieves whether per-pixel shader-based lighting is active.

virtual DtLightManager& makVrv::DtOsgLightManager::lightManager ( )
virtual

Get the internal light manager implementation object.

virtual void makVrv::DtOsgLightManager::setReservedID ( int  id)
virtual

Reserves a light ID that the light manager won't mess with.

virtual int makVrv::DtOsgLightManager::reservedID ( ) const
virtual

Retrieves the reserved light ID, or -1 if none.

virtual bool makVrv::DtOsgLightManager::registerLight ( const osg::LightSource *  light,
const osg::NodePath &  nodePath,
const osg::Matrixd &  modelingMatrix,
bool  globalLights,
const osg::Camera *  osgCamera 
)
virtual

Add a light source to the ones globally managed.

virtual void makVrv::DtOsgLightManager::deregisterLight ( const osg::LightSource *  light)
virtual
virtual void makVrv::DtOsgLightManager::update ( const osg::State &  state,
const osg::Camera *  camera 
)
virtual

Active the underlying GLLight's, transformed by the matrix passed in on a per camera basis.

virtual void makVrv::DtOsgLightManager::releaseGLObjects ( void  )
virtual

release gl objects

virtual unsigned int makVrv::DtOsgLightManager::getOrCreateLightSourceTypeId ( const osg::LightSource &  lightSource)
virtual

find or create a light source type id for an osg::LightSource

virtual unsigned int makVrv::DtOsgLightManager::getOrCreateDynamicLightSourceTypeId ( const DtLight pDtLight)
virtual

find or create a light source type id for a light source that will be changing over time. good for particle system light sources and the flashlight

virtual void makVrv::DtOsgLightManager::deleteDynamicLightSourceTypeId ( const DtLight pDtLight)
virtual

delete a dynamic light source type id. Makes it available to be used by a different light source

virtual LightReusableVector makVrv::DtOsgLightManager::lightSourceTypeLightVector ( ) const
virtual

get the light source types that are registered with this light manager be careful with this since it makes a copy of the vector for thread safety

virtual void makVrv::DtOsgLightManager::updateLightSourceType ( unsigned int  id,
const DtLight light 
)
virtual

update a light source in the registered types.

virtual const DtOsgLightingComponent* makVrv::DtOsgLightManager::lightingComponent ( ) const
virtual

get the lighting component created by this osg light manager.

virtual DtOsgLightingComponent* makVrv::DtOsgLightManager::lightingComponent ( )
virtual

get the lighting component created by this osg light manager (non-const)

static DtOsgLightManager& makVrv::DtOsgLightManager::instance ( DtDe de)
static

Get/create instance of light manager.

static const std::string& makVrv::DtOsgLightManager::theClassName ( )
static

Get the name this class is registered by.

virtual bool makVrv::DtOsgLightManager::computeLightStatusForTime ( const DtLight pDtLight,
float  ambientLightValue 
) const
protectedvirtual

Will only turn off lights when it is too bright (won't turn on lights)

virtual void makVrv::DtOsgLightManager::updateShaderBasedLights ( const osg::State &  state,
const osg::Camera *  camera,
DtOsgLightManagerTcsUserData tcsUserData 
)
protectedvirtual

update the information needed to render the dynamic lights. This needs to be done on a per camera basis because it runs at the start of draw. When there is a planar reflection camera the cull for two cameras runs and then the draw for those two cameras run so we have to keep the light data separate for each camera in that case.

virtual void makVrv::DtOsgLightManager::computeFrustumLights ( const osg::State &  state,
const osg::Camera *  camera,
DtOsgLightManagerTcsUserData tcsUserData 
) const
protectedvirtual
virtual void makVrv::DtOsgLightManager::computeActiveLights ( DtOsgLightManagerTcsUserData tcsUserData,
const osg::Camera *  camera 
) const
protectedvirtual

update on/off status

virtual void makVrv::DtOsgLightManager::proccessLightPath ( DtLight inLight,
const osg::NodePath &  nodePath 
)
protectedvirtual
virtual void makVrv::DtOsgLightManager::configurePerPixelLighting ( osg::StateSet *  )
protectedvirtual
virtual void makVrv::DtOsgLightManager::slot_reloadShader ( )
protectedvirtual
virtual bool makVrv::DtOsgLightManager::existsInLightManager ( const DtLight light) const
protectedvirtual
virtual void makVrv::DtOsgLightManager::convertOsgLightToDtLight ( DtLight pDtLight,
const osg::LightSource &  lightSource,
const osg::Matrixd &  modelingMatrix 
)
protectedvirtual

update a DtLight's parameters based on an osg::LightSource

virtual void makVrv::DtOsgLightManager::getWorldPositionAndDirection ( const osg::LightSource &  lightSource,
const osg::Matrixd &  modelingMatrix,
osg::Vec3d &  vWorldPos,
osg::Vec3d &  vWorldDir 
) const
protectedvirtual

get the world position and direction from a light source

virtual unsigned int makVrv::DtOsgLightManager::getOrCreateLightSourceTypeId ( const DtLight pDtLight)
protectedvirtual

find or create a light source type id for this light source

virtual unsigned int makVrv::DtOsgLightManager::sensorMaskFromLightSource ( const osg::LightSource &  lightSource) const
protectedvirtual

utility function to get the sensorMask from a light source based on the comments on the node.

virtual size_t makVrv::DtOsgLightManager::getNodePathHashValue ( const osg::NodePath &  nodePath) const
protectedvirtual

compute node path hash value

virtual void makVrv::DtOsgLightManager::printNodePath ( const osg::NodePath &  nodePath) const
protectedvirtual

print node path hash

virtual size_t makVrv::DtOsgLightManager::computeHash ( const DtLight pDtLight) const
protectedvirtual

compute light hash

virtual LightType makVrv::DtOsgLightManager::lightType ( const osg::Light *  light) const
protectedvirtual

Get the DtLightManager LightType for an osg light.

virtual unsigned int makVrv::DtOsgLightManager::getOrCreateLightSourceTypeId ( const DtLight pDtLight,
size_t  hash 
)
protectedvirtual
virtual void makVrv::DtOsgLightManager::slot_preTick ( void  )
protectedvirtual

pre tick

Member Data Documentation

const int makVrv::DtOsgLightManager::theMwirLightSourceSensorMask = 0b0100
static
const int makVrv::DtOsgLightManager::theLwirLightSourceSensorMask = 0b1000
static
const int makVrv::DtOsgLightManager::theIrLightSourceSensorMask = theMwirLightSourceSensorMask | theLwirLightSourceSensorMask
static
const int makVrv::DtOsgLightManager::theNvgLightSourceSensorMask = 0b0010
static
const int makVrv::DtOsgLightManager::theVisualLightSourceSensorMask = 0b0001
static
const int makVrv::DtOsgLightManager::theDefaultLightSourceSensorMask = theNvgLightSourceSensorMask | theVisualLightSourceSensorMask
static
DtDe& makVrv::DtOsgLightManager::myDe
protected
bool makVrv::DtOsgLightManager::myInitialized
protected
bool makVrv::DtOsgLightManager::myDebugCallbackInitialized
protected
int makVrv::DtOsgLightManager::myReservedID
protected
bool makVrv::DtOsgLightManager::myPerPixelLightingEnabled
protected
osg::ref_ptr<DtOsgLightingComponent> makVrv::DtOsgLightManager::myLightingComponent
protected
osg::observer_ptr<osg::StateSet> makVrv::DtOsgLightManager::myStateSet
protected
DtLightManager* makVrv::DtOsgLightManager::myLightManager
protected
MapLightSourceHashToLights makVrv::DtOsgLightManager::myMapLightSourceHashToLights
protected
std::unordered_set<const DtLight*> makVrv::DtOsgLightManager::myLightsCreatedViaRegister
protected
std::mutex makVrv::DtOsgLightManager::myRegisterUnRegisterPathMutex
mutableprotected
DtOsgLightsObserver* makVrv::DtOsgLightManager::myOsgLightsObserver
protected
MapLightSourceTypeToLightID makVrv::DtOsgLightManager::myLightSourceTypeMap
protected
LightReusableVector makVrv::DtOsgLightManager::myLightSourceTypeLightVector
protected
boost::mutex makVrv::DtOsgLightManager::myMutableLightSourceTypeMutex
mutableprotected
DtThreadCameraStreamDataManager& makVrv::DtOsgLightManager::myTcsDataManager
protected
DtOsgLightManagerTcsUserDataCreator& makVrv::DtOsgLightManager::myUserDataCreator
protected
DtSignalConnectionManager makVrv::DtOsgLightManager::myConnections
protected

The documentation for this class was generated from the following file:

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)