VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectSwitchManager.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>
16 
18 
20 
23 
24 #include <osgSim/MultiSwitch>
25 #include <osg/Node>
26 #include <osg/ref_ptr>
27 #include <osg/observer_ptr>
28 #include <osg/Switch>
29 
30 #include <list>
31 #include <deque>
32 
33 namespace osg
34 {
35  class Sequence;
36  class RenderInfo;
37  class FrameStamp;
38 }
39 
40 namespace osgSim
41 {
42  class MultiSwitch;
43 }
44 
45 namespace makVrv
46 {
47  struct PerGeomInstance;
48  class DtInstanceContainer;
49  class DtDynamicTerrainSwitchNode;
50  class DtSwitchInstanceState;
51  class DtDe;
52  class DtGlBuffer;
53 
56 
59 
61  template <>
62  inline const char* creatorTypeName<DtIndirectSwitchManager>(void) { return "DtIndirectSwitchManagerCreator"; }
63 
71  {
72  public:
73 
74  typedef osg::observer_ptr<osg::Node> NodeObserverPtr;
75  typedef std::pair<NodeObserverPtr, DtIndirectSwitchInfo> NodeSwitchInfoPair;
76  typedef std::deque<NodeSwitchInfoPair> DequeNodeSwitchInfoPairs;
77  typedef std::vector<DequeNodeSwitchInfoPairs> DequeNodeSwitchInfoPairsArray;
78 
79  typedef std::vector<DtIndirectSwitchInfo> VectorIndirectSwitchInfos;
80  typedef std::map<int, VectorIndirectSwitchInfos> MapIntToVectorIndirectSwitchInfos;
81  typedef std::map<NodeObserverPtr, MapIntToVectorIndirectSwitchInfos > MapNodeToMapIntToVectorIndirectSwitchInfos;
82 
83  public:
86 
88  virtual ~DtIndirectSwitchManager();
89  protected:
92 
93  private:
95  DtIndirectSwitchManager() = delete;
97  DtIndirectSwitchManager(const DtIndirectSwitchManager& other) = delete;
99  DtIndirectSwitchManager& operator=(const DtIndirectSwitchManager& other) = delete;
100 
101  public:
103  virtual void addSwitchPaths(int perGeomInstanceIndex, int size, const DequeNodeSwitchInfoPairs& parentSwitchPaths, const DequeNodeSwitchInfoPairsArray& switchPaths, const osg::NodePath& parentNodePath, int instanceId);
104 
106  virtual void slot_setSwitchDynamicTerrainSwitchNode(DtDynamicTerrainSwitchNode* switchNode, DynamicTerrain::NodePathHash nodePathHash, int childIdx);
107 
110  virtual void update(const osg::FrameStamp* frameStamp);
111 
113  virtual void processSwitches(void);
114 
116  virtual void releaseGLObjects(osg::State* state) const;
117 
119  virtual const DtGlBuffer* gpuSwitchStateBuffer(void) const;
120 
121  protected:
122 
124  virtual void addSwitchPath(int perGeomInstanceIndex, const DequeNodeSwitchInfoPairs& parentSwitchPaths, const DequeNodeSwitchInfoPairs& switchPath, const osg::NodePath& parentNodePath, int instanceId);
125 
127  virtual void addSwitch(NodeSwitchInfoPair& switchChildPair, int bitMaskId, int perGeomInstanceIndex, const osg::NodePath& parentNodePath, int uniqueId);
128 
130  virtual bool checkSwitchChildActive(osg::ref_ptr<osg::Node> nodeRefPtr, int childIndex, DynamicTerrain::NodePathHash pathHash);
131 
133  virtual void updateSwitches(void);
134 
136  virtual void updateMultiSwitches(void);
137 
139  virtual void updateSequences(const osg::FrameStamp* frameStamp);
140 
142  virtual void updateSwitchStateBufferIfNecessary(void);
143 
145  virtual void deleteBuffers(void);
146 
148  virtual void tearDownBuffers(void) const;
149 
151  virtual void updateSwitch(const DtIndirectSwitchInfo& info, bool isSwitchChildActive);
152 
154  virtual void addSequence(osg::Sequence* sequence, int instanceId);
155 
156  protected:
157 
159 
160  std::set<DtDynamicTerrainSwitchNode*> mySetDynamicTerrainSwitchNodes;
161 
162  // These are the 'master' sequences
163  typedef std::map<osg::Sequence*, unsigned int> MapSequenceToValue;
165 
166  // These are the 'master' switches
167  typedef std::map<osg::Switch*, osg::Switch::ValueList> MapSwitchToValueList;
169 
170  // These are the 'master' multi-switches
171  typedef std::map<osgSim::MultiSwitch*, osgSim::MultiSwitch::ValueList> MapMultiSwitchToValueList;
173 
174 
177 
179  {
180  void operator()(int& info);
181  };
182 
183  //which parent switches of this geometry are turned off
184  //(so if this is 0 then all switches are turned on and the geometry should be visible)
187 
189  };
190 
191 }
Contains makVrv::DtIndirectSwitchInfo struct.
parent manager class for all Indirect managers. Managers handle information about a specific feature ...
Definition: DtIndirectManager.h:26
DtDynamicTerrainSwitchNode replaces an osgSim::multiswitch in a terrain patch (or page) that is tagge...
Definition: DtDynamicTerrainSwitchNode.h:74
size_t NodePathHash
Typedef used to represent a hash of an OSG Node path to a referenced node.
Definition: DtMultiReferencedNodeContainer.h:26
std::set< DtDynamicTerrainSwitchNode * > mySetDynamicTerrainSwitchNodes
Definition: DtIndirectSwitchManager.h:160
std::map< int, VectorIndirectSwitchInfos > MapIntToVectorIndirectSwitchInfos
Definition: DtIndirectSwitchManager.h:80
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
handles the switches for all the indirect geometry. Sets up the default state of osg::Switch, osgSim::MultiSwitch, and DtDynamicTerrainSwitchNode. Connects to a signal for the DtDynamicTerrainSwitchNode so it can update the indirect buffer when a switch changes. saves off the node path hash for every switch path that is added. Owned by a DtIndirectGeometry 1:1 This manager&#39;s switches get updated per frame via looking at the actual switches/multi-switches
Definition: DtIndirectSwitchManager.h:70
Contains makVrv::DtIndirectManager class.
voidpf void uLong size
Definition: ioapi.h:39
friend DtIndirectSwitchManagerCreator
only creator can create
Definition: DtIndirectSwitchManager.h:85
std::deque< NodeSwitchInfoPair > DequeNodeSwitchInfoPairs
Definition: DtIndirectSwitchManager.h:76
const char * creatorTypeName< DtIndirectSwitchManager >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectSwitchManager.h:62
DtGlBuffer * myGpuSwitchStateBuffer
Definition: DtIndirectSwitchManager.h:188
MapSequenceToValue myMapSequenceToValue
Definition: DtIndirectSwitchManager.h:164
std::map< NodeObserverPtr, MapIntToVectorIndirectSwitchInfos > MapNodeToMapIntToVectorIndirectSwitchInfos
Definition: DtIndirectSwitchManager.h:81
VectorSwitchesOffBitMask myVectorSwitchesOffBitMask
Definition: DtIndirectSwitchManager.h:186
DtSignalConnectionManager myConnections
Definition: DtIndirectSwitchManager.h:175
MapSwitchToValueList myMapSwitchToValueList
Definition: DtIndirectSwitchManager.h:168
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
MapMultiSwitchToValueList myMapMultiSwitchToValueList
Definition: DtIndirectSwitchManager.h:172
osg::observer_ptr< osg::Node > NodeObserverPtr
Definition: DtIndirectSwitchManager.h:74
Contains makVrv::DtVirtualBaseClass class.
MapNodeToMapIntToVectorIndirectSwitchInfos myMapNodeToVectorIndirectSwitchInfos
Definition: DtIndirectSwitchManager.h:158
bool myMutableSwitchesDirty
Definition: DtIndirectSwitchManager.h:176
std::map< osg::Sequence *, unsigned int > MapSequenceToValue
Definition: DtIndirectSwitchManager.h:163
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
std::map< osg::Switch *, osg::Switch::ValueList > MapSwitchToValueList
Definition: DtIndirectSwitchManager.h:167
DtVirtualBaseClassCreator< DtIndirectSwitchManager, DtInstanceContainer & > DtIndirectSwitchManagerCreator
creator
Definition: DtIndirectSwitchManager.h:55
std::pair< NodeObserverPtr, DtIndirectSwitchInfo > NodeSwitchInfoPair
Definition: DtIndirectSwitchManager.h:75
std::vector< DequeNodeSwitchInfoPairs > DequeNodeSwitchInfoPairsArray
Definition: DtIndirectSwitchManager.h:77
A generic OpenGL buffer. This can be: -&gt; a vertex buffer -&gt; an index buffer -&gt; a shader storage buffe...
Definition: DtGlBuffer.h:29
Contains makVrv::DtMultiReferencedNodeContainer class.
std::map< osgSim::MultiSwitch *, osgSim::MultiSwitch::ValueList > MapMultiSwitchToValueList
Definition: DtIndirectSwitchManager.h:171
Base class to provide boost signal/slot management.
Contains makVrv::DtReusableMemoryVector class.
std::vector< DtIndirectSwitchInfo > VectorIndirectSwitchInfos
Definition: DtIndirectSwitchManager.h:79
structure for holding the information about a particular instance of a particular switch...
Definition: DtIndirectSwitchInfo.h:25
Contains DLL export macros.
DtReusableMemoryVector< int, SwitchesOffBitMaskInvalidator > VectorSwitchesOffBitMask
Definition: DtIndirectSwitchManager.h:185
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
Helper class to manage instances This class allows you to add a DtInstance_64 Internally, however it stores this as a DtInstance (which the GPU can directly read)
Definition: DtInstanceContainer.h:31

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)