VR-Forces 4.5 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtOsgEffectTextureController.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2016 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 #include <osg/Referenced>
14 #include <osgDB/Options>
15 
16 #include <set>
17 #include <string>
18 #include <vector>
19 #include <boost/thread.hpp>
20 namespace osg
21 {
22  class StateSet;
23  class Texture;
24 }
25 namespace osgEarth
26 {
27  class VirtualProgram;
28 }
29 
30 namespace makVrv
31 {
32  class DtOsgShaderManager;
33  class DtOsgFileCache;
34 
37  class DT_DLL_VRVOSG DtOsgEffectTextureController : public osg::Referenced
38  {
39  public:
42 
43  public: // Implementation methods
44 
46  virtual std::string getEffectTypeCode() const =0;
47 
48  typedef std::map<std::string, std::string> FilenameMap;
49 
51  virtual osg::Texture* installEffectTexture(osg::Texture* baseTexture, int texUnit, osg::StateSet* stateSet, const osgDB::Options* dbOptions, const FilenameMap& possibleFilenames);
52 
54  virtual void findEffectTexture(const std::string& baseTextureName, const osgDB::Options* dbOptions, const FilenameMap &possibleFilenames, const osg::Texture* baseTexture, osg::ref_ptr<osg::Texture>& effectTexture);
55 
57  virtual bool generateShaders(int baseUnit, int effectUnit, osg::Texture* tex, osg::StateSet* stateSet, const std::string& baseTextureName) { return true; }
58 
59  public: // Utility methods
60 
62  virtual bool isEffectTexture(osg::Texture* tex) const;
63 
66  virtual bool effectTextureInstalled(const std::string& baseTextureName, osg::StateSet* stateSet) const;
67 
68  // find the file path for a texture.
69  static std::string getTextureFilePath(osg::Texture* texture);
70 
71  // find the extended name for a texture file.
72  std::string getExtendedFileName(const std::string& baseFileName) const;
73 
74  // Given the file name of a base texture, populate the output
75  // vector with possible file names for corresponding effect textures.
76  void getPossibleEffectTextureFileNames(const std::string& baseFileName, std::vector<std::string>& output) const;
77 
78  protected:
79 
80  std::string myVertSource;
81  std::string myFragSource;
83 
86 
87  // applies default shader LOD ranges, if applicable
88  void applyDefaultShaderLODRanges(osgEarth::VirtualProgram* vp, const std::string& function) const;
89 
91 
92  const std::string myShaderFolderPath;
93 
94  static boost::mutex s_controllerMutex;
95 
96  };
97 }

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)