VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtIndirectEntityGeometry.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2022 VT-MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
14 
15 namespace makVrv
16 {
19 
22 
24  template <>
25  inline const char* creatorTypeName<DtIndirectEntityGeometry>(void) { return "DtIndirectEntityGeometryCreator"; }
26 
39  {
40  public:
43 
46  template<class T>
48  {
51  };
52 
53  template<class T>
55  {
58  int myFlags = 0;
59  };
60 
62  typedef std::unordered_map<int, Matrix4_32> MapInstanceIdToXform;
63 
69  typedef std::unordered_map< osgSim::MultiSwitch*, MultiSwitchPair> MapCloneToMultiSwitchPair;
70  typedef std::unordered_map< int, MapCloneToMultiSwitchPair> MapInstanceToMapCloneToMasterMultiSwitches;
71 
72  //Use the pair to hold the refs and the raw pointer to index into the map
76  typedef std::unordered_map< osgSim::DOFTransform*, DofTransformPair > MapCloneToDofTransformPair;
77  typedef std::unordered_map< int, MapCloneToDofTransformPair> MapInstanceToMapCloneToMasterDofs;
78 
79  //Use the pair to hold the refs and the raw pointer to index into the map
83  typedef std::unordered_map< osg::Sequence*, SequencePair > MapCloneToSequencePair;
84  typedef std::unordered_map< int, MapCloneToSequencePair> MapInstanceToMapCloneToMasterSequences;
85 
87  typedef std::map< const std::string, DtIndirectUvOffsetManager::UvOffset> MapAnnotationToUvOffsetData;
88  typedef std::unordered_map< int, MapAnnotationToUvOffsetData> MapInstanceToMapAnnotationToUvOffsetData;
89 
90  typedef std::unordered_map< int, std::tuple<float, float, float> > MapInstanceToUvOffset;
91 
92  public:
94  virtual ~DtIndirectEntityGeometry();
95 
96  protected:
98  DtIndirectEntityGeometry(DtDe& de, const DtCullShaderConfig& cullShaderConfig, bool terrainPatch);
99 
100  private:
102  DtIndirectEntityGeometry() = delete;
104  DtIndirectEntityGeometry(const DtIndirectEntityGeometry& other) = delete;
106  DtIndirectEntityGeometry& operator=(const DtIndirectEntityGeometry& other) = delete;
107 
108  public:
110  virtual void setInstanceMatrixTransform(int instanceId, const Matrix4_32& xForm);
111 
113  virtual Matrix4_32 instanceMatrixTransform(int instanceId) const;
114 
116  virtual void removeInstance(int id);
117 
119  virtual void setInstanceMultiSwitch(int id, osgSim::MultiSwitch* clone, osgSim::MultiSwitch* master);
120 
122  virtual void instanceMultiSwitches(int instanceIdIndirect, MapCloneToMultiSwitchPair& mapCloneToMasterMultiSwitches) const;
123 
125  virtual void setInstanceUvOffset(int id, const std::string& annotation, float uOffset, float vOffset);
126 
128  virtual void scrollUv(int id, const std::tuple<float, float, float>& uvspeeds);
129 
131  virtual void instanceAnnotationsAndUvOffsets(int instanceIdIndirect, std::vector<DtIndirectAnnotationAndUvOffset>& annotations) const;
132 
134  virtual void setInstanceColor(int instanceIdIndirect, const Vector4_32& color);
136  virtual Vector4_32 instanceColor(int instanceIdIndirect) const;
138 
140  virtual void setInstanceOtherData0(int instanceIdIndirect, const Vector4_32& data);
142  virtual Vector4_32 instanceOtherData0(int instanceIdIndirect) const;
144 
146  virtual void setInstanceVisibility(int instanceIdIndirect, bool visible);
148  virtual bool instanceVisibility(int instanceIdIndirect) const;
150 
152  virtual void setInstanceLightPointMaxDistance(int instanceIdIndirect, float lightPointMaxDistance);
154  virtual float instanceLightPointMaxDistance(int instanceIdIndirect) const;
156 
158  virtual void setInstanceDof(int id, osgSim::DOFTransform* clone, osgSim::DOFTransform* master, int animationFlags);
159 
161  virtual void setInstanceDofTranslation(int id, osgSim::DOFTransform* clone, osgSim::DOFTransform* master
162  , const Vector3_64& trans
163  , const Vector3_64& transVel);
164 
166  virtual void setInstanceDofOrientation(int id, osgSim::DOFTransform* clone, osgSim::DOFTransform* master
167  , const Vector3_64& hpr
168  , const Vector3_64& hprVel
169  , int animationFlags);
170 
172  virtual void setInstanceDofOrientation(int id, osgSim::DOFTransform* clone, osgSim::DOFTransform* master
173  , const Vector3_64& hprVel
174  , bool forceUpdate
175  , int animationFlags);
176 
178  virtual void instanceDofs(int instanceIdIndirect, MapCloneToDofTransformPair& mapCloneToDofTransformPair) const;
179 
181  virtual void setInstanceSequence(int id, osg::Sequence* clone, osg::Sequence* master);
182 
184  virtual void instanceSequences(int instanceIdIndirect, MapCloneToSequencePair& mapCloneToMasterSequences) const;
185 
186 
190  virtual bool hasInProgressInstanceMove() const;
191 
193  virtual void addInProgressInstanceMove();
194 
196  virtual void subtractInProgressInstanceMove();
197 
198  protected:
200  virtual void setMultiSwitchOnInstanceInInstanceContainer(int instanceContainerId, osgSim::MultiSwitch* clone, osgSim::MultiSwitch* master);
201 
203  virtual void setDofOnInstanceInInstanceContainer(int instanceContainerId, osgSim::DOFTransform* clone, osgSim::DOFTransform* master, int animationFlags);
204 
206  virtual void setUvOffsetOnInstanceInInstanceContainer(const int instanceId, const std::string& annotation, float uOffset, float vOffset);
207 
209  virtual void removeInstanceInInstanceContainer(int instanceContainerId);
210 
213  virtual void removeInstanceFromIndicesCount(int instanceContainerIndex);
214 
216  virtual void updateInstancePositionOrientationAddedActual(const DtIndirectGeometryInstance& instance, int outInstanceIndex) override;
217 
219  virtual void updateInstanceSwitchesAddedActual(const DtIndirectGeometryInstance& instance, int outInstanceIndex) override;
220 
222  virtual void updateInstanceSequencesAddedActual(const DtIndirectGeometryInstance& instance, int outInstanceIndex) override;
223 
225  virtual void updateInstanceUvOffsetsAddedActual(const DtIndirectGeometryInstance& instance, int outInstanceIndex) override;
226 
228  virtual void updateInstanceColorAddedActual(const DtIndirectGeometryInstance& instance, int outInstanceIndex) override;
229 
231  virtual void updateInstanceOtherData0AddedActual(const DtIndirectGeometryInstance& instance, int outInstanceIndex) override;
232 
234  virtual void updateInstanceVisibilityLightPointMaxDistanceActual(const DtIndirectGeometryInstance& instance, int outInstanceIndex) override;
235 
237  virtual bool updateInstanceDeletionBeforeAddedActual(const DtIndirectGeometryInstance& instance) override;
238 
240  virtual void updateInstancesDofsAddedActual(const DtIndirectGeometryInstance& instance, int outInstanceIndex) override;
241 
242 
243  protected:
245  //typedef std::unordered_map<int, Matrix4_32> MapInstanceIdToXform;
247 
248  //Left the typedefs here commented out so they are easier to follow. They need to be at the
249  // top so they can be used as arguments in the functions.
250 
255  //typedef CloneMasterPair<osgSim::MultiSwitch> MultiSwitchPair;
256  //typedef std::map< osgSim::MultiSwitch*, MultiSwitchPair> MapCloneToMultiSwitchPair;
257  //typedef std::map< int, MapCloneToMultiSwitchPair> MapInstanceToMapCloneToMasterMultiSwitches;
259 
260  //Use the pair to hold the refs and the raw pointer to index into the map
263  //typedef CloneMasterPair<osgSim::DOFTransform> DofTransformPair;
264  //typedef std::unordered_map< osgSim::DOFTransform*, DofTransformPair > MapCloneToDofTransformPair;
265  //typedef std::unordered_map< int, MapCloneToDofTransformPair> MapInstanceToMapCloneToMasterDofs;
267 
268  //Use the pair to hold the refs and the raw pointer to index into the map
271  //typedef CloneMasterPair<osg::Sequence> SequencePair;
272  //typedef std::unordered_map< osg::Sequence*, SequencePair > MapCloneToSequencePair;
273  //typedef std::unordered_map< int, MapCloneToSequencePair> MapInstanceToMapCloneToMasterSequences;
275 
277  //typedef std::unordered_map< const std::string, DtIndirectUvOffsetManager::UvOffset> MapAnnotationToUvOffsetData;
278  //typedef std::unordered_map< int, MapAnnotationToUvOffsetData> MapInstanceToMapAnnotationToUvOffsetData;
280 
282  //typedef std::unordered_map< int, DtIndirectUvOffsetManager::UvOffset> MapInstanceToUvOffset;
284 
285 
287  std::unordered_map<int, Vector4_32> myMapInstanceToColor;
288 
290  std::unordered_map<int, Vector4_32> myMapInstanceToOtherData0;
291 
293  std::unordered_map<int, bool> myMapInstanceToVisibility;
294 
296  std::unordered_map<int, float> myMapInstanceToLightPointMaxDistance;
297 
299  typedef std::unordered_set<int> SetInstancesToDelete;
301 
303 
304  };
305 }
osg::ref_ptr< T > myMaster
Definition: DtIndirectEntityGeometry.h:50
const char * creatorTypeName< DtIndirectEntityGeometry >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtIndirectEntityGeometry.h:25
std::unordered_map< int, std::tuple< float, float, float > > MapInstanceToUvOffset
Definition: DtIndirectEntityGeometry.h:90
non virtual container class for holding the information needed to create an indirect geometry instanc...
Definition: DtIndirectGeometryInstance.h:26
osg::ref_ptr< T > myClone
Definition: DtIndirectEntityGeometry.h:49
std::unordered_set< int > SetInstancesToDelete
Structure to hold instance ids to be deleted.
Definition: DtIndirectEntityGeometry.h:299
std::unordered_map< int, MapCloneToSequencePair > MapInstanceToMapCloneToMasterSequences
Definition: DtIndirectEntityGeometry.h:84
MapInstanceToMapCloneToMasterSequences myMapInstanceToMapCloneToMasterSequences
Maps an instance id and a master sequence to the clone sequence so we can get to the cloned sequence ...
Definition: DtIndirectEntityGeometry.h:274
MapCloneToDofTransformPairAndFlags< osgSim::DOFTransform > DofTransformPair
Maps an instance id and a master dof to the clone dof so we can get to the cloned dof which contains ...
Definition: DtIndirectEntityGeometry.h:75
osg::ref_ptr< T > myClone
Definition: DtIndirectEntityGeometry.h:56
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
Definition: featureContext.h:37
MapInstanceToMapCloneToMasterDofs myMapInstanceToMapCloneToMasterDofs
Maps an instance id and a master dof to the clone dof so we can get to the cloned dof which contains ...
Definition: DtIndirectEntityGeometry.h:266
CloneMasterPair< osgSim::MultiSwitch > MultiSwitchPair
Structure to hold instance multi-switches&#39; state until the instance is actually added Use the pair to...
Definition: DtIndirectEntityGeometry.h:68
std::map< const std::string, DtIndirectUvOffsetManager::UvOffset > MapAnnotationToUvOffsetData
Maps and instance id and a string to the current uv offset for this particular annotation.
Definition: DtIndirectEntityGeometry.h:87
std::unordered_map< osg::Sequence *, SequencePair > MapCloneToSequencePair
Definition: DtIndirectEntityGeometry.h:83
shader configuration storage class. Has 3 available options which are described in the constructor&#39;s ...
Definition: DtCullShaderConfig.h:21
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
Inherited from DtIndirectGeometry additionally implements: -removal of instances -ability to set/get ...
Definition: DtIndirectEntityGeometry.h:38
\ ::, which allows us to hook into our indirect engine to render using indirect rendering...
Definition: DtIndirectGeometry.h:115
std::unordered_map< osgSim::MultiSwitch *, MultiSwitchPair > MapCloneToMultiSwitchPair
Definition: DtIndirectEntityGeometry.h:69
CloneMasterPair< osg::Sequence > SequencePair
Maps an instance id and a master sequence to the clone sequence so we can get to the cloned sequence ...
Definition: DtIndirectEntityGeometry.h:82
MapInstanceToMapCloneToMasterMultiSwitches myMapInstanceToMapCloneToMasterMultiSwitches
Structure to hold instance multi-switches&#39; state until the instance is actually added Use the pair to...
Definition: DtIndirectEntityGeometry.h:258
std::unordered_map< int, Matrix4_32 > MapInstanceIdToXform
Structure to hold instance orientation until the instance is actually added.
Definition: DtIndirectEntityGeometry.h:62
std::unordered_map< int, MapCloneToMultiSwitchPair > MapInstanceToMapCloneToMasterMultiSwitches
Definition: DtIndirectEntityGeometry.h:70
friend DtIndirectEntityGeometryCreator
only creator can create
Definition: DtIndirectEntityGeometry.h:42
int myNumInProgressInstanceMoves
Definition: DtIndirectEntityGeometry.h:302
osg::ref_ptr< T > myMaster
Definition: DtIndirectEntityGeometry.h:57
Contains DLL export macros.
MapInstanceIdToXform myMapInstanceIdToXform
Structure to hold instance orientation until the instance is actually added.
Definition: DtIndirectEntityGeometry.h:246
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:70
std::unordered_map< osgSim::DOFTransform *, DofTransformPair > MapCloneToDofTransformPair
Definition: DtIndirectEntityGeometry.h:76
std::unordered_map< int, Vector4_32 > myMapInstanceToOtherData0
Maps an instance id to the other data0 for that instance.
Definition: DtIndirectEntityGeometry.h:290
MapInstanceToMapAnnotationToUvOffsetData myMapInstanceToMapAnnotationToUvOffsetData
Maps and instance id and a string to the current uv offset for this particular annotation.
Definition: DtIndirectEntityGeometry.h:279
std::unordered_map< int, bool > myMapInstanceToVisibility
Maps an instance id to the visibility for that instance.
Definition: DtIndirectEntityGeometry.h:293
std::unordered_map< int, float > myMapInstanceToLightPointMaxDistance
Maps an instance id to the light point max distance for that instance.
Definition: DtIndirectEntityGeometry.h:296
MapInstanceToUvOffset myMapInstanceToUvOffset
Maps and instance id to the current uv offset for all scrollable uv offsets.
Definition: DtIndirectEntityGeometry.h:283
Contains the DtIndirectGeometry class declaration.
Helper struct to make the code a bit more clear. Used instead of std::pair to hold a pair of ref_ptr&#39;...
Definition: DtIndirectEntityGeometry.h:47
std::unordered_map< int, MapAnnotationToUvOffsetData > MapInstanceToMapAnnotationToUvOffsetData
Definition: DtIndirectEntityGeometry.h:88
std::unordered_map< int, MapCloneToDofTransformPair > MapInstanceToMapCloneToMasterDofs
Definition: DtIndirectEntityGeometry.h:77
4 dimensional matrix
Definition: DtMatrix4.h:22
std::unordered_map< int, Vector4_32 > myMapInstanceToColor
Maps an instance id to the color for that instance.
Definition: DtIndirectEntityGeometry.h:287
DtVirtualBaseClassCreator< DtIndirectEntityGeometry, const DtCullShaderConfig &, const bool & > DtIndirectEntityGeometryCreator
creator
Definition: DtIndirectEntityGeometry.h:18
SetInstancesToDelete mySetInstancesIndirectIdsToDelete
Definition: DtIndirectEntityGeometry.h:300

Document ID: Generated on Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)