VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgEffectTextureVisitor.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
14 
15 #include <osgDB/Options>
16 
17 #include <osg/NodeVisitor>
18 #include <osg/ExtendedMaterial>
19 
20 #include <string>
21 
22 namespace makVrv
23 {
24  class DtOsgEffectTextureController;
25  class DtOsgFileCache;
26  class DtOsgShaderManager;
27 
34  class DT_DLL_VRVOSG DtOsgEffectTextureVisitor : public osg::NodeVisitor
35  {
36  public:
39 
41  DtOsgEffectTextureVisitor(DtOsgFileCache&, const osgDB::Options* options);
42 
44  virtual void setDbOptions(const osgDB::Options* options);
45 
47  virtual ~DtOsgEffectTextureVisitor();
48 
51  virtual void reset();
52 
55  virtual unsigned numEffectTexturesInstalled() const;
56 
57  static const char* ignoreHint(void);
58 
59  public: // osg::NodeVisitor overrides
60 
61  void apply(osg::Node& node);
62  void apply(osg::Geode& geode);
63 
64  protected:
65 
67  void initialize();
68 
70  void apply(osg::StateSet* stateSet);
71 
73  virtual bool isEffectTexture(osg::Texture* tex, const std::string& texName) const;
74 
75  // check is we already visited this stateSet.
76  // \param extendedMaterial osg::ExtendedMaterial in this stateSet
77  virtual bool checkIfAlreadyVisited(osg::StateSet* stateSet, osg::ExtendedMaterial* extendedMaterial);
78 
79  //Install the effect texture, it will first trying to read the effect texture from the
80  //extended material, if it's not supported in extended material or failed to find it in extended material
81  //we try the postfix way.
82  virtual void installEffectTexture(osg::StateSet* stateSet, osg::Texture* baseTexture, int baseUnit,
83  osg::ExtendedMaterial* extendedMaterial);
84 
85  //Install the effect texture from the osg::ExtendedMaterial
86  virtual bool installExtendedEffectTexture(const DtOsgEffectTextureController* controller,
87  osg::StateSet* stateSet, osg::Texture* baseTexture, osg::Texture* effectTexture, int baseUnit, int effectUnit);
88 
89  virtual bool installExtendedEffectTexture(const DtOsgEffectTextureController* controller
90  , osg::StateSet* stateSet, osg::Texture* baseTexture, int baseUnit, osg::ExtendedMaterial* extendedMaterial);
91 
98  virtual bool installPostfixEffectTexturesFromTextureLayers(const DtOsgEffectTextureController* controller, osg::Texture* baseTex,
99  int baseTexUnit, osg::StateSet* stateSet);
100 
107  virtual bool installPostfixEffectTexturesFromFileSytem(const DtOsgEffectTextureController* controller, osg::Texture* baseTex,
108  int baseTexUnit, osg::StateSet* stateSet);
109 
113  virtual bool checkForGlassMaterial(osg::StateSet* stateSet);
114 
115  protected:
116  unsigned myCount;
117 
118  osg::ref_ptr<const osgDB::Options> myDbOptions;
120 
122 
123  static const char* theIgnoreHint;
124  };
125 }

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)