VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgShaderManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 
13 #include <vrvOsg/vrvOsg.h>
14 
15 #include <osg/ref_ptr>
16 #include <osg/Camera>
17 
18 #include <string>
19 
22 
23 #include <boost/thread/shared_mutex.hpp>
24 
25 // The highest texture unit number you plan on using
26 // Can go as high as 8
27 #define MAX_TEXTURES 8
28 
29 // We stick the environment cube map above the highest "normal"
30 // slot to avoid interference with OSG textures
31 #define ENV_MAP_SLOT 8
32 
33 // Max number of simultaneously active lights. The lights closest to the
34 // observer are selected.
35 // Don't raise this above 40, or you'll run out of uniform space.
36 // You may want to lower this to restrict the workload on the fragment programs
37 #define MAX_LIGHTS 10
38 
39 namespace osg
40 {
41  class Node;
42  class StateSet;
43  class Texture;
44 }
45 
46 namespace makVrv
47 {
48  class DtOpenGLCubeMap;
49  class DtOsgFileCache;
50 
56  {
57  public:
59  static DtOsgShaderManager& instance(DtDe& de);
60 
62  virtual ~DtOsgShaderManager();
63 
65  static std::string theClassName();
66 
68  void setPerPixelLightingEnabled(bool enabled);
69 
71  bool getPerPixelLightingEnabled() const;
72 
80  void generateShaders(osg::Node* node, const std::string& name ="", bool shareState =true, bool force=false);
81 
83  void ts_generateShaders(osg::Node* node, DtOsgFileCache& fileCache, const std::string& name ="", bool shareState =true, bool force=false);
84 
87  void removeShaders(osg::Node* node);
88 
90  void ts_removeShaders(osg::Node* node);
91 
94  void optimizeStateSharing(osg::Node* node);
95 
97  const std::string& shaderFolderPath() const;
98 
101  void cullReset();
102 
104  void disableShaders(osg::StateSet *stateSet);
105 
108  void installEnvironmentMap(osg::Camera* camera);
109 
113  boost::shared_mutex& optimizeStateSetMutex();;
114 
115  protected:
116  DtOsgShaderManager( DtDe& de );
117 
121 
123 
125 
126  std::string myShaderFolderPath;
127 
128  boost::shared_mutex myOptimizeStateSetMutex;
129 
130  private:
132 
134  };
135 }
Diagonal crossing liens.
Definition: DtTacticalGraphicUtilities.h:93
boost::shared_mutex myOptimizeStateSetMutex
Definition: DtOsgShaderManager.h:128
bool myPerPixelLightingEnabled
Definition: DtOsgShaderManager.h:119
Virtual base class.
Definition: DtVirtualBaseClass.h:22
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
bool myPendingPerPixelLightingState
Definition: DtOsgShaderManager.h:120
osg::ref_ptr< DtOpenGLCubeMap > myEnvironmentMapTexture
Definition: DtOsgShaderManager.h:124
std::string myShaderFolderPath
Definition: DtOsgShaderManager.h:126
Contains makVrv::DtVirtualBaseClass class.
The OSG implementation of makVrv::DtOsgFileCache.
Definition: DtOsgFileCache.h:55
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:24
DtSignalConnectionManager myConnections
Definition: DtOsgShaderManager.h:133
DtOsgShaderManager injects custom shaders into the scenes, and keeps their uniform parameters set to ...
Definition: DtOsgShaderManager.h:55
Base class to provide boost signal/slot management.
bool myPerPixelLightingStateChanged
Definition: DtOsgShaderManager.h:118
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
DtDe & myDe
Definition: DtOsgShaderManager.h:122

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)