VR-Forces 4.10 Class Documentation
 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 
70  {
71  public:
72 
73  typedef osg::observer_ptr<osg::Node> NodeObserverPtr;
74  typedef std::pair<NodeObserverPtr, DtIndirectSwitchInfo> NodeSwitchInfoPair;
75  typedef std::deque<NodeSwitchInfoPair> DequeNodeSwitchInfoPairs;
76  typedef std::vector<DequeNodeSwitchInfoPairs> DequeNodeSwitchInfoPairsArray;
77 
78  typedef std::vector<DtIndirectSwitchInfo> VectorIndirectSwitchInfos;
79  typedef std::map<int, VectorIndirectSwitchInfos> MapIntToVectorIndirectSwitchInfos;
80  typedef std::map<NodeObserverPtr, MapIntToVectorIndirectSwitchInfos > MapNodeToMapIntToVectorIndirectSwitchInfos;
81 
82  public:
85 
87  virtual ~DtIndirectSwitchManager();
88  protected:
91 
92  private:
94  DtIndirectSwitchManager() = delete;
96  DtIndirectSwitchManager(const DtIndirectSwitchManager &other) = delete;
98  DtIndirectSwitchManager &operator=(const DtIndirectSwitchManager &other) = delete;
99 
100  public:
102  virtual void addSwitchPaths(int perGeomInstanceIndex, int size, const DequeNodeSwitchInfoPairs& parentSwitchPaths, const DequeNodeSwitchInfoPairsArray& switchPaths, const osg::NodePath& parentNodePath, int instanceId);
103 
105  virtual void removeSwitchPaths(int instanceId);
106 
108  virtual void slot_setSwitchDynamicTerrainSwitchNode(DtDynamicTerrainSwitchNode* switchNode, DynamicTerrain::NodePathHash nodePathHash, int childIdx);
109 
112  virtual void slot_setSwitch(osgSim::MultiSwitch* clone, osgSim::MultiSwitch* master, int instanceId);
113 
114  virtual void slot_setSequence(osg::Sequence* clone, osg::Sequence* master, int instanceId);
117  virtual void update(const osg::FrameStamp* frameStamp);
118 
119  virtual void updateActiveSequences(const osg::FrameStamp* frameStamp);
122  virtual void setPureSignalBasedSwitches(bool val);
123 
126  virtual bool pureSignalBasedSwitches(void) const;
127 
129  virtual void processSwitches(void);
130 
132  virtual void releaseGLObjects(osg::State* state) const;
133 
135  virtual const DtGlBuffer* gpuSwitchStateBuffer(void) const;
136 
137  protected:
138 
140  virtual void addSwitchPath(int perGeomInstanceIndex, const DequeNodeSwitchInfoPairs& parentSwitchPaths, const DequeNodeSwitchInfoPairs& switchPath, const osg::NodePath& parentNodePath, int instanceId);
141 
143  virtual void addSwitch(NodeSwitchInfoPair& switchChildPair, int bitMaskId, int perGeomInstanceIndex, const osg::NodePath& parentNodePath, int uniqueId);
144 
146  virtual bool checkSwitchChildActive(osg::ref_ptr<osg::Node> nodeRefPtr, int childIndex, DynamicTerrain::NodePathHash pathHash);
147 
149  virtual void updateSwitches(void);
150 
152  virtual void updateMultiSwitches(void);
153 
155  virtual void updateSequences(const osg::FrameStamp* frameStamp);
156 
158  virtual void printInfo();
159 
161  virtual void updateSwitchStateBufferIfNecessary(void);
162 
164  virtual void deleteBuffers(void);
165 
167  virtual void tearDownBuffers(void) const;
168 
170  virtual void updateSwitch(const DtIndirectSwitchInfo& info, bool isSwitchChildActive);
171 
172  protected:
173 
175 
176  std::set<DtDynamicTerrainSwitchNode*> mySetDynamicTerrainSwitchNodes;
177 
178  // These are the 'master' sequences
179  typedef std::map<osg::Sequence*, unsigned int> MapSequenceToValue;
181 
182  // These are the 'master' switches
183  typedef std::map<osg::Switch*, osg::Switch::ValueList> MapSwitchToValueList;
185 
186  // These are the 'master' multi-switches
187  typedef std::map<osgSim::MultiSwitch*, osgSim::MultiSwitch::ValueList> MapMultiSwitchToValueList;
189 
190  //Map the master to the clone or in the default case the master to the master
192  {
193  public:
194  osg::Sequence* mySequence;
195  unsigned int myValue;
196  };
197  typedef std::map<osg::Sequence*, SequenceAndValue > MapOfSequences;
198  typedef std::map<int, MapOfSequences> MapInstanceToMapOfSequences;
200 
203 
205  {
206  void operator()(int& info);
207  };
208 
209  //which parent switches of this geometry are turned off
210  //(so if this is 0 then all switches are turned on and the geometry should be visible)
213 
215 
217  };
218 
219 }
Contains makVrv::DtIndirectSwitchInfo struct.
parent manager class for all Indirect managers.
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: DtIndirectSwitchInfo.h:23
std::set< DtDynamicTerrainSwitchNode * > mySetDynamicTerrainSwitchNodes
Definition: DtIndirectSwitchManager.h:176
std::map< int, VectorIndirectSwitchInfos > MapIntToVectorIndirectSwitchInfos
Definition: DtIndirectSwitchManager.h:79
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
handles the switches for all the indirect geometry.
Definition: DtIndirectSwitchManager.h:69
Contains makVrv::DtIndirectManager class.
bool myPureSignalBasedSwitches
Definition: DtIndirectSwitchManager.h:216
voidpf void uLong size
Definition: ioapi.h:39
friend DtIndirectSwitchManagerCreator
only creator can create
Definition: DtIndirectSwitchManager.h:84
std::deque< NodeSwitchInfoPair > DequeNodeSwitchInfoPairs
Definition: DtIndirectSwitchManager.h:75
std::map< int, MapOfSequences > MapInstanceToMapOfSequences
Definition: DtIndirectSwitchManager.h:198
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:214
MapSequenceToValue myMapSequenceToValue
Definition: DtIndirectSwitchManager.h:180
std::map< NodeObserverPtr, MapIntToVectorIndirectSwitchInfos > MapNodeToMapIntToVectorIndirectSwitchInfos
Definition: DtIndirectSwitchManager.h:80
VectorSwitchesOffBitMask myVectorSwitchesOffBitMask
Definition: DtIndirectSwitchManager.h:212
DtSignalConnectionManager myConnections
Definition: DtIndirectSwitchManager.h:201
MapSwitchToValueList myMapSwitchToValueList
Definition: DtIndirectSwitchManager.h:184
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
MapMultiSwitchToValueList myMapMultiSwitchToValueList
Definition: DtIndirectSwitchManager.h:188
osg::observer_ptr< osg::Node > NodeObserverPtr
Definition: DtIndirectSwitchManager.h:73
Contains makVrv::DtVirtualBaseClass class.
MapNodeToMapIntToVectorIndirectSwitchInfos myMapNodeToVectorIndirectSwitchInfos
Definition: DtIndirectSwitchManager.h:174
bool myMutableSwitchesDirty
Definition: DtIndirectSwitchManager.h:202
std::map< osg::Sequence *, unsigned int > MapSequenceToValue
Definition: DtIndirectSwitchManager.h:179
unsigned int myValue
Definition: DtIndirectSwitchManager.h:195
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
std::map< osg::Switch *, osg::Switch::ValueList > MapSwitchToValueList
Definition: DtIndirectSwitchManager.h:183
DtVirtualBaseClassCreator< DtIndirectSwitchManager, DtInstanceContainer & > DtIndirectSwitchManagerCreator
creator
Definition: DtIndirectSwitchManager.h:55
Definition: DtIndirectSwitchManager.h:191
std::pair< NodeObserverPtr, DtIndirectSwitchInfo > NodeSwitchInfoPair
Definition: DtIndirectSwitchManager.h:74
std::vector< DequeNodeSwitchInfoPairs > DequeNodeSwitchInfoPairsArray
Definition: DtIndirectSwitchManager.h:76
osg::Sequence * mySequence
Definition: DtIndirectSwitchManager.h:194
A generic OpenGL buffer.
Definition: DtGlBuffer.h:27
Contains makVrv::DtMultiReferencedNodeContainer class.
std::map< osgSim::MultiSwitch *, osgSim::MultiSwitch::ValueList > MapMultiSwitchToValueList
Definition: DtIndirectSwitchManager.h:187
Base class to provide boost signal/slot management.
Contains makVrv::DtReusableMemoryVector class.
std::vector< DtIndirectSwitchInfo > VectorIndirectSwitchInfos
Definition: DtIndirectSwitchManager.h:78
structure for holding the information about a particular instance of a particular switch...
Definition: DtIndirectSwitchInfo.h:31
Contains DLL export macros.
DtReusableMemoryVector< int, SwitchesOffBitMaskInvalidator > VectorSwitchesOffBitMask
Definition: DtIndirectSwitchManager.h:211
The DtDe is the core component of any VR-Vantage application.
Definition: DtDe.h:69
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
std::map< osg::Sequence *, SequenceAndValue > MapOfSequences
Definition: DtIndirectSwitchManager.h:197
MapInstanceToMapOfSequences myActiveMapSequenceToInfo
Definition: DtIndirectSwitchManager.h:199

Document ID: Generated on Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)