VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtOsgShaderManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 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 
17 #include <string>
18 
21 
22 // The highest texture unit number you plan on using
23 // Can go as high as 8
24 #define MAX_TEXTURES 8
25 
26 // We stick the environment cube map above the highest "normal"
27 // slot to avoid interference with OSG textures
28 #define ENV_MAP_SLOT 8
29 
30 // Max number of simultaneously active lights. The lights closest to the
31 // observer are selected.
32 // Don't raise this above 40, or you'll run out of uniform space.
33 // You may want to lower this to restrict the workload on the fragment programs
34 #define MAX_LIGHTS 10
35 
36 namespace osg
37 {
38  class Node;
39  class StateSet;
40  class Texture;
41 }
42 
43 namespace makVrv
44 {
45  class DtOpenGLCubeMap;
46  class DtOsgStateComponentContext;
47  class DtOsgFileCache;
48 
54  {
55  public:
57  static DtOsgShaderManager& instance(DtDe& de);
58 
60  virtual ~DtOsgShaderManager();
61 
63  static std::string theClassName();
64 
66  void setPerPixelLightingEnabled(bool enabled);
67 
69  bool getPerPixelLightingEnabled() const;
70 
78  void generateShaders(osg::Node* node, const std::string& name ="", bool shareState =true, bool force=false);
79 
81  void ts_generateShaders(osg::Node* node, DtOsgFileCache& fileCache, const std::string& name ="", bool shareState =true, bool force=false);
82 
85  void removeShaders(osg::Node* node);
86 
88  void ts_removeShaders(osg::Node* node);
89 
92  void optimizeStateSharing(osg::Node* node);
93 
95  const std::string& getShaderFolderPath() const;
96 
99  void cullReset();
100 
102  void disableShaders(osg::StateSet *stateSet);
103 
105  osg::Texture* getOrCreateEnvironmentMapTexture();
106 
108  void installEnvironmentMap(osg::StateSet* stateSet);
109 
110  protected:
111  DtOsgShaderManager( DtDe& de );
112 
116 
118 
119  osg::ref_ptr<DtOpenGLCubeMap> myEnvironmentMapTexture;
120 
121  osg::ref_ptr<DtOsgStateComponentContext> myStateComponentContext;
122 
123  private:
125 
127  };
128 }

Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (www.mak.com)