VR-Forces 4.6 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) 20183 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 // The highest texture unit number you plan on using
24 // Can go as high as 8
25 #define MAX_TEXTURES 8
26 
27 // We stick the environment cube map above the highest "normal"
28 // slot to avoid interference with OSG textures
29 #define ENV_MAP_SLOT 8
30 
31 // Max number of simultaneously active lights. The lights closest to the
32 // observer are selected.
33 // Don't raise this above 40, or you'll run out of uniform space.
34 // You may want to lower this to restrict the workload on the fragment programs
35 #define MAX_LIGHTS 10
36 
37 namespace osg
38 {
39  class Node;
40  class StateSet;
41  class Texture;
42 }
43 
44 namespace makVrv
45 {
46  class DtOpenGLCubeMap;
47  class DtOsgStateComponentContext;
48  class DtOsgFileCache;
49 
55  {
56  public:
58  static DtOsgShaderManager& instance(DtDe& de);
59 
61  virtual ~DtOsgShaderManager();
62 
64  static std::string theClassName();
65 
67  void setPerPixelLightingEnabled(bool enabled);
68 
70  bool getPerPixelLightingEnabled() const;
71 
79  void generateShaders(osg::Node* node, const std::string& name ="", bool shareState =true, bool force=false);
80 
82  void ts_generateShaders(osg::Node* node, DtOsgFileCache& fileCache, const std::string& name ="", bool shareState =true, bool force=false);
83 
86  void removeShaders(osg::Node* node);
87 
89  void ts_removeShaders(osg::Node* node);
90 
93  void optimizeStateSharing(osg::Node* node);
94 
96  const std::string& getShaderFolderPath() const;
97 
100  void cullReset();
101 
103  void disableShaders(osg::StateSet *stateSet);
104 
107  void installEnvironmentMap(osg::Camera* camera);
108 
109  protected:
110  DtOsgShaderManager( DtDe& de );
111 
115 
117 
118  osg::ref_ptr<DtOpenGLCubeMap> myEnvironmentMapTexture;
119 
120  osg::ref_ptr<DtOsgStateComponentContext> myStateComponentContext;
121 
122  private:
124 
126  };
127 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)