VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOceanExtractorVisitor.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <osg/NodeVisitor>
17 
18 #include <boost/regex.hpp>
19 
20 #include <ostream>
21 #include <string>
22 #include <vector>
23 #include <unordered_set>
24 
25 namespace osg
26 {
27  class Geode;
28  class Group;
29  class Node;
30  class LOD;
31 };
32 
33 namespace makVrv
34 {
43  class DtOceanExtractorVisitor : public osg::NodeVisitor
44  {
45  public:
47  typedef std::vector<boost::regex> RegexVector;
48 
54  const std::string& rule, bool isRegEx, bool indirect );
55 
57  virtual ~DtOceanExtractorVisitor();
58 
59  public:
65  virtual void apply(osg::Group& group);
66 
69  virtual void apply(osg::Node& node);
70 
72  virtual bool nodesExtracted() const;
73 
74  protected:
76  virtual bool extractStaticOcean(osg::Node& node);
77 
79  virtual bool checkTextures( const osg::Node& node );
80 
82  virtual bool makeNodeStaticOcean( osg::Node& node);
83 
84  protected:
85  std::string mySearchForString;
88  osg::Group* myStartGroup;
90  std::unordered_set<int> myTexturesRemoved;
91  std::unordered_set<int> myTextureNonMatchCache;
93  std::vector<osg::ref_ptr<osg::Node> > myNodesToRemove;
94  const bool myOceanIsIndirect;
95  };
96 
97 }
std::unordered_set< int > myTextureNonMatchCache
Definition: DtOceanExtractorVisitor.h:91
virtual bool checkTextures(const osg::Node &node)
Check the textures pointed to by a node against the search criteria.
bool myNodesExtracted
Definition: DtOceanExtractorVisitor.h:92
virtual void apply(osg::Group &group)
This is the method called when the visitor is visiting groups We detect the DtTerrainPatchGroup (via ...
Declaration of the makVrv::DtTextureVisitor class.
const bool myOceanIsIndirect
Definition: DtOceanExtractorVisitor.h:94
virtual ~DtOceanExtractorVisitor()
Virtual DTOR.
bool myExpressionIsRegEx
Definition: DtOceanExtractorVisitor.h:87
std::unordered_map< int, std::string > TextureMap
typdef a map of textures
Definition: DtTextureVisitor.h:36
RegexVector mySearchForRegularExpressions
Definition: DtOceanExtractorVisitor.h:86
virtual bool makeNodeStaticOcean(osg::Node &node)
When a static ocean node is discovered, mark it.
std::vector< boost::regex > RegexVector
typdef a vector of regex for convenience
Definition: DtOceanExtractorVisitor.h:47
DtOceanExtractorVisitor tags nodes as static ocean via the setUserValue capability, based on a texture name or texture regular expression. Terrain nodes have a DtOsgTextureKeyHolder in their userData fields which holds a list of the keys to a texture map of all the textures applied to the node. If one of the textures on the node matches the search string or regular expression than the node has a setUserValue( &quot;isStaticOcean&quot;, true ) set on it.
Definition: DtOceanExtractorVisitor.h:43
DtTextureVisitor::TextureMap & myTextureMap
Definition: DtOceanExtractorVisitor.h:89
Contains DLL export macros.
virtual bool extractStaticOcean(osg::Node &node)
Method called on a node to attempt extraction.
virtual bool nodesExtracted() const
Return whether any nodes were marked as static ocean.
std::vector< osg::ref_ptr< osg::Node > > myNodesToRemove
Definition: DtOceanExtractorVisitor.h:93
std::string mySearchForString
Definition: DtOceanExtractorVisitor.h:85
std::unordered_set< int > myTexturesRemoved
Definition: DtOceanExtractorVisitor.h:90
osg::Group * myStartGroup
Definition: DtOceanExtractorVisitor.h:88
DtOceanExtractorVisitor(DtTextureVisitor::TextureMap &textureMap, const std::string &rule, bool isRegEx, bool indirect)
Default CTOR Inputs are the map of textures held be the terrain pactch, the search string or regular ...

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)