VR-Forces Developer's Guide
 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) 2019 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  class DtEffectControllerContainer;
28 
35  class DT_DLL_VRVOSG DtOsgEffectTextureVisitor : public osg::NodeVisitor
36  {
37  public:
40 
42  DtOsgEffectTextureVisitor(DtDe& de, DtOsgFileCache&, const osgDB::Options* options);
43 
45  virtual void setDbOptions(const osgDB::Options* options);
46 
48  virtual ~DtOsgEffectTextureVisitor();
49 
52  virtual void reset();
53 
56  virtual unsigned numEffectTexturesInstalled() const;
57 
58  static const char* ignoreHint(void);
59 
60  public: // osg::NodeVisitor overrides
61 
62  void apply(osg::Node& node);
63  void apply(osg::Geode& geode);
64 
65  protected:
66 
68  void initialize();
69 
71  void apply(osg::StateSet* stateSet);
72 
74  virtual bool isEffectTexture(osg::Texture* tex, const std::string& texName) const;
75 
76  // check is we already visited this stateSet.
77  // \param extendedMaterial osg::ExtendedMaterial in this stateSet
78  virtual bool checkIfAlreadyVisited(osg::StateSet* stateSet, osg::ExtendedMaterial* extendedMaterial);
79 
80  //Install the effect texture, it will first trying to read the effect texture from the
81  //extended material, if it's not supported in extended material or failed to find it in extended material
82  //we try the postfix way.
83  virtual void installEffectTexture(osg::StateSet* stateSet, osg::Texture* baseTexture, int baseUnit,
84  osg::ExtendedMaterial* extendedMaterial);
85 
86  //Install the effect texture from the osg::ExtendedMaterial
87  virtual bool installExtendedEffectTexture(const DtOsgEffectTextureController* controller,
88  osg::StateSet* stateSet, osg::Texture* baseTexture, osg::Texture* effectTexture, int baseUnit, int effectUnit);
89 
90  virtual bool installExtendedEffectTexture(const DtOsgEffectTextureController* controller
91  , osg::StateSet* stateSet, osg::Texture* baseTexture, int baseUnit, osg::ExtendedMaterial* extendedMaterial);
92 
99  virtual bool installPostfixEffectTexturesFromTextureLayers(const DtOsgEffectTextureController* controller, osg::Texture* baseTex,
100  int baseTexUnit, osg::StateSet* stateSet);
101 
108  virtual bool installPostfixEffectTexturesFromFileSystem(const DtOsgEffectTextureController* controller, osg::Texture* baseTex,
109  int baseTexUnit, osg::StateSet* stateSet);
110 
114  virtual bool checkForGlassMaterial(osg::StateSet* stateSet);
115 
116  protected:
117  unsigned myCount;
118 
121 
123 
125 
126  static const char* theIgnoreHint;
127 
129  };
130 }
A thread safe cache containing a list of possible file names for effect textures, based on the curren...
Definition: DtPossibleFileNamesCache.h:27
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
DtPossibleFileNamesCache myPossibleFileNamesCache
Definition: DtOsgEffectTextureVisitor.h:122
DtOsgFileCache & myFileCache
Definition: DtOsgEffectTextureVisitor.h:120
DtDe & myDe
Definition: DtOsgEffectTextureVisitor.h:128
The OSG implementation of makVrv::DtOsgFileCache. This will cache files as .ive&#39;s for quicker load ti...
Definition: DtOsgFileCache.h:56
Contains the DtPossibleFileNamesCache class.
Base class for controllers that install and control effect textures.
Definition: DtOsgEffectTextureController.h:44
osg::ref_ptr< const osgDB::Options > myDbOptions
Definition: DtOsgEffectTextureVisitor.h:119
static const char * theIgnoreHint
Definition: DtOsgEffectTextureVisitor.h:126
unsigned myCount
Definition: DtOsgEffectTextureVisitor.h:117
Contains DLL export macros.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
Definition: DtEffectControllerContainer.h:22
Visitor that locates effect textures and installs them into the scene graph. Run this prior to runnin...
Definition: DtOsgEffectTextureVisitor.h:35
DtEffectControllerContainer & myEffectControllerContainer
Definition: DtOsgEffectTextureVisitor.h:124

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)