VR-Forces 4.3.1 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 optimizeStateSharing(osg::Node* node);
86 
88  const std::string& getShaderFolderPath() const;
89 
92  void cullReset();
93 
95  void disableShaders(osg::StateSet *stateSet);
96 
98  osg::Texture* getOrCreateEnvironmentMapTexture();
99 
101  void installEnvironmentMap(osg::StateSet* stateSet);
102 
103  protected:
104  DtOsgShaderManager( DtDe& de );
105 
109 
111 
112  osg::ref_ptr<DtOpenGLCubeMap> myEnvironmentMapTexture;
113 
114  osg::ref_ptr<DtOsgStateComponentContext> myStateComponentContext;
115 
116  private:
118 
120  };
121 }

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)