VR-Forces 4.3.1 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) 2013 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 
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::set<std::string> FilenameSet;
49 
51  virtual osg::Texture* installEffectTexture(osg::Texture* baseTexture, int texUnit, osg::StateSet* stateSet, const osgDB::Options* dbOptions, const FilenameSet& possibleFilenames);
52 
54  virtual osg::Texture* findEffectTexture(const std::string& baseTextureName, const osgDB::Options* dbOptions, const FilenameSet &possibleFilenames, osg::Texture* baseTexture);
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(osg::Texture* baseTexture, 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 
92 
93  std::string myShaderFolderPath;
94  };
95 }

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)