VR-Forces 4.3 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 <string>
16 
17 #include <osgEarth/StateSetCache>
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 
53  {
54  public:
56  static DtOsgShaderManager& instance(DtDe& de);
57 
59  virtual ~DtOsgShaderManager();
60 
62  static std::string theClassName();
63 
65  void setPerPixelLightingEnabled(bool enabled);
66 
68  bool getPerPixelLightingEnabled() const;
69 
77  void generateShaders(osg::Node* node, const std::string& name ="", bool shareState =true, bool force=false);
78 
81  void optimizeStateSharing(osg::Node* node);
82 
84  const std::string& getShaderFolderPath() const;
85 
88  void cullReset();
89 
91  void disableShaders(osg::StateSet *stateSet);
92 
94  osg::Texture* getOrCreateEnvironmentMapTexture();
95 
97  void installEnvironmentMap(osg::StateSet* stateSet);
98 
99  protected:
100  DtOsgShaderManager( DtDe& de );
101 
105 
107 
108  osg::ref_ptr<DtOpenGLCubeMap> myEnvironmentMapTexture;
109 
110  osg::ref_ptr<DtOsgStateComponentContext> myStateComponentContext;
111 
112  private:
114 
116  };
117 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)