VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgLightManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
14 
16 #include <boost/unordered_map.hpp>
17 
18 #include <osg/observer_ptr>
19 #include <osg/Node>
20 #include <osg/Light>
21 
22 #include <matrix/vlVector.h>
23 
24 namespace osg
25 {
26  class Light;
27  class LightSource;
28  class State;
29  class StateSet;
30  class Matrixd;
31 }
32 
33 namespace makVrv
34 {
35  // Implements GLSL lighting
36  class DtOsgLightsObserver;
37  class DtLightManager;
39 
40  typedef std::vector<DtLight> VectorLightObjects;
41 
47  {
48  public:
50  virtual ~DtOsgLightManager();
51 
52  protected:
55 
58 
59  public:
60 
62  virtual void initialize();
63 
66  virtual void attachToStateSet(osg::StateSet* stateSet);
67 
69  virtual void setPerPixelLightingEnabled(bool enabled);
70 
72  virtual bool perPixelLightingEnabled() const;
73 
75  virtual DtLightManager& lightManager();
76 
78  virtual void setReservedID(int id);
79 
81  virtual int reservedID() const;
82 
85  virtual void cullReset();
86 
88  virtual bool registerLight(const osg::LightSource* light, const osg::NodePath& nodePath, const osg::Matrixd& modelingMatrix, bool globalLights);
89 
90  // PPP: TO DO. How to deregister ligths?
91  virtual void deregisterLight(const osg::LightSource* light);
92 
94  virtual void update(const osg::State& state, DtDe& de);
95 
96  virtual int getTextureStartOffset(void) const;
97  virtual const Vector2_uint32& GetTileSize(void) const;
98  virtual const Vector2_uint32& GetGridMaxDims(void) const;
99 
100  virtual void releaseGLObjects(void);
101  public:
103  static DtOsgLightManager& instance(DtDe& de);
104 
106  static const std::string& theClassName();
107 
109  static LightType lightType(const osg::Light* light);
110 
111  protected:
112  virtual void updateLightOnOffStatus(DtDe& de, const VectorLights& lights);
113 
115  virtual bool computeLightStatusForTime(DtDe& de, DtLight* pDtLight, DtOsgSkyObject* skyObject);
116 
117  virtual void updateFixedFunctionLights(const osg::State& state);
118 
119  virtual void updateShaderBasedLights(const osg::State& state, const VectorLights& lights);
120 
121  virtual const VectorLights& computeFrustumLights(const osg::State &state);
122 
123  virtual void proccessLightPath(DtLight* inLight, const osg::NodePath& nodePath);
124 
125  virtual void configurePerPixelLighting(osg::StateSet*);
126 
127  virtual void setComponentVisualizationMode(int mode);
128 
129  virtual void slot_reloadShader();
130 
131  virtual bool existsInLightManager(const DtLight* light) const;
132 
133  protected:
138 
140 
144  osg::observer_ptr<osg::StateSet> myStateSet;
145  VectorLights myActiveLights;
146 
148 
149  typedef std::pair<const osg::LightSource*, const makVrv::DtLight*> LightSourceAndLight;
150 
151  typedef boost::unordered_map<size_t, LightSourceAndLight> MapLightSourceHashToLights;
153 
154  DtOsgLightsObserver* myOsgLightsObserver;
155  };
156 }
DtLightManager * myLightManager
Definition: DtOsgLightManager.h:147
LightManager class which allows creation/deletion of lights.
Definition: DtLightManager.h:30
Virtual base class.
Definition: DtVirtualBaseClass.h:22
std::vector< DtLight > VectorLightObjects
Definition: DtOsgLightManager.h:38
DtDe & myDe
Definition: DtOsgLightManager.h:134
MapLightSourceHashToLights myMapLightSourceHashToLights
Definition: DtOsgLightManager.h:152
DtOsgLightsObserver * myOsgLightsObserver
Definition: DtOsgLightManager.h:154
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
bool myPerPixelLightingEnabled
Definition: DtOsgLightManager.h:139
An OSG implementation of the sky.
Definition: DtOsgSkyObject.h:46
boost::unordered_map< size_t, LightSourceAndLight > MapLightSourceHashToLights
Definition: DtOsgLightManager.h:151
bool myInitialized
Definition: DtOsgLightManager.h:135
osg::observer_ptr< osg::StateSet > myStateSet
Definition: DtOsgLightManager.h:144
Light class.
LightType
Definition: DtLight.h:32
VectorLights myActiveLights
Definition: DtOsgLightManager.h:145
DtOsgLightManager receives LightSource nodes from the DtOsgCullVisitor, and collects them all here wh...
Definition: DtOsgLightManager.h:46
int myReservedID
Definition: DtOsgLightManager.h:137
bool myDebugCallbackInitialized
Definition: DtOsgLightManager.h:136
Contains the DtOsgLightingComponent class.
Class for generic lights.
Definition: DtLight.h:48
const char int mode
Definition: ioapi.h:38
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
osg::ref_ptr< osg::Uniform > myComponentDebugUniform
Definition: DtOsgLightManager.h:142
osg::ref_ptr< DtOsgLightingComponent > myLightingComponent
Definition: DtOsgLightManager.h:141
bool myLightingComponentInstalled
Definition: DtOsgLightManager.h:143
std::pair< const osg::LightSource *, const makVrv::DtLight * > LightSourceAndLight
Definition: DtOsgLightManager.h:149

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)