VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtAttachableUpdater.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * Copyright (c) 2023 MAK Technologies, Inc.
3 * All rights reserved.
4 *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/DtUniqueID.h>
13 #include <vrvCore/DtTickable.h>
14 #include <vrvCore/DtSceneObject.h>
16 
17 #include <matrix/vlVector.h>
18 #include <matrix/vlTaitBryan.h>
19 
20 #include <list>
21 
22 namespace makVrv
23 {
24 
25  class DtDe;
26  class DtSceneObject;
27  class DtModel;
28  class DtSceneObjectUpdater;
29 
36 
37  {
38  public:
39 
42  {
47  AttachedPointTypeInvalidObject
48  };
49 
51  {
54  AttachedPointModeOrientationOnly
55  };
56 
59  {
60  public:
61 
62  AttachedPoint( AttachedPointType type, int targetVertexIndex,
63  const DtVector& positionOffset )
64  : myAttachedPointType( type )
65  , myTargetVertexIndex( targetVertexIndex )
66  , myPositionOffset( positionOffset )
67  , myAttachedPointMode(AttachedPointModePositionAndOrientation)
68  {
69  }
70 
71  virtual ~AttachedPoint() {}
72 
74  {
75  return myAttachedPointType;
76  }
77 
79  {
80  return myTargetVertexIndex;
81  }
82 
83  void setPositionOffset(const DtVector& o)
84  {
85  myPositionOffset = o;
86  }
87 
88  const DtVector& positionOffset() const
89  {
90  return myPositionOffset;
91  }
92 
94  {
95  myAttachedPointMode = mode;
96  }
97 
99  {
100  return myAttachedPointMode;
101  }
102 
103  protected:
104 
109 
110  };
111 
114  {
115  public:
116 
118  int targetVertexIndex, const DtVector& positionOffset )
119  : AttachedPoint( AttachedPointTypeObject, targetVertexIndex, positionOffset )
120  , mySceneObject( sceneObject )
121  , myUpdater( updater )
122  , mySceneObjectId( 0 )
123  {
124  if( sceneObject )
125  {
126  mySceneObjectId = sceneObject->uniqueId();
127  }
128  }
129 
130  virtual ~ObjectAttachedPoint() {}
131 
132  inline void setSceneObject( DtSceneObject* sceneObject )
133  {
134  mySceneObject = sceneObject;
135 
136  if (sceneObject)
137  {
138  mySceneObjectId = sceneObject->uniqueId();
139  }
140  else
141  {
142  mySceneObjectId = 0;
143  }
144  }
145 
146  inline DtUniqueID sceneObjectId() const
147  {
148  return mySceneObjectId;
149  }
150 
151  inline DtSceneObject* sceneObject() const
152  {
153  return mySceneObject;
154  }
155 
156  inline void setUpdater( DtSceneObjectUpdater* updater )
157  {
158  myUpdater = updater;
159  }
160 
161  inline DtSceneObjectUpdater* updater() const
162  {
163  return myUpdater;
164  }
165 
166  // When the class is destructed, the scene object may or may not
167  // exist. Using a separate connection variable makes it possible to
168  // 'disconnect' even if the scene object has been deleted.
169  boost::signalslib::connection mySceneObjectConnection;
170  boost::signalslib::connection mySceneObjectUpdaterConnection;
171 
172  protected:
173 
177  };
178 
182  {
183  public:
184 
185  VertexAttachedPoint( const DtVector& position, int targetVertexIndex,
186  const DtVector& positionOffset )
187  : AttachedPoint( AttachedPointTypeVertex, targetVertexIndex, positionOffset )
188  , myVertex( position )
189  {
190  }
191  virtual ~VertexAttachedPoint() {}
192 
193  DtVector vertex() const
194  {
195  return myVertex;
196  }
197 
198  protected:
199 
200  DtVector myVertex;
201  };
202 
206  {
207  public:
208 
210  int vtx1, int vtx2, double proportion, int targetVertexIndex,
211  const DtVector& positionOffset )
212  : ObjectAttachedPoint( sceneObject, updater, targetVertexIndex, positionOffset )
213  , myFirstVtx( vtx1 )
214  , mySecondVtx( vtx2 )
215  , myProportion( proportion )
216  {
217  myAttachedPointType = AttachedPointTypeProportional;
218  }
219 
220  inline int firstVtx()
221  {
222  return myFirstVtx;
223  }
224 
225  inline int secondVtx()
226  {
227  return mySecondVtx;
228  }
229 
230  inline double proportion()
231  {
232  return myProportion;
233  }
234 
235  protected:
236 
239  double myProportion;
240 
241  };
242 
243  public:
244 
247 
249  virtual ~DtAttachableUpdater();
250 
252  virtual bool needsUpdate( DtTime tNow );
253 
257  virtual void addAttachedPoint( const DtVector& position, int targetVertexIndex );
258 
262  virtual void addAttachedPoint( DtUniqueID sceneObjectId, int targetVertexIndex );
263 
267  virtual void addAttachedPoint( DtElementID elementId, DtModelSetId modelSet, int targetVertexIndex );
268 
272  virtual void addAttachedPoint( DtUniqueID sceneObjectId, int vtx1, int vtx2,
273  double proportion, int targetVertexIndex );
274 
279  virtual const AttachedPoint& attachedPoint( int targetVertexIndex ) const;
280 
283  virtual void setPositionOffset( const DtVector& offset );
284 
288  virtual void setWorldPositionOffset( const DtVector& offset );
289 
293  virtual void setPositionOffset( const DtVector& offset, int vtx );
294 
297  virtual void setOrientationOffset(const DtTaitBryan& offset);
298 
301  virtual void setWorldOrientationOffset(const DtTaitBryan& offset);
302 
304  virtual void setAttachedPointMode( unsigned int mode, int vtx );
305 
307  virtual void update( DtTime tNow );
308 
311  virtual void setSceneObject( DtSceneObject* sceneObject );
312 
315  virtual void setModel( DtModel* model );
316 
319  virtual void doAttachment( DtTime tNow );
320 
321  inline DtTime lastUpdateTime() const
322  {
323  return myLastUpdateTime;
324  }
325 
326  protected:
327 
330  virtual void slot_sceneObjectToBeDeleted( const DtUniqueID& id );
331  virtual void slot_modelToBeDeleted( DtModel* model );
332  virtual void slot_attachedSceneObjectToBeDeleted( const DtUniqueID& );
333  virtual void slot_attachedUpdaterToBeDeleted( const DtUniqueID& id );
335 
336  // get values of attached point at simTime
337  virtual bool pointLocationAndOrientation( AttachedPoint* point,
338  double simTime, DtVector& location, DtTaitBryan& orientation );
339 
341  virtual void removeAttachedPoint(int vtx, DtVector* positionOffset = 0);
342 
343  protected:
346 
349 
352 
355 
356  // When the class is destructed, the scene object may or may not
357  // exist. Using a separate connection variable makes it possible to
358  // 'disconnect' even if the scene object has been deleted.
359  boost::signalslib::connection mySceneObjectOrModelConnection;
360  boost::signalslib::connection mySceneObjectUpdaterConnection;
361 
362  typedef std::vector<AttachedPoint*> AttachedPointsVector;
364 
366  DtTaitBryan myOrientationOffset;
367 
370 
372  };
373 }
int targetVertexIndex()
Definition: DtAttachableUpdater.h:78
AttachedPointType myAttachedPointType
Definition: DtAttachableUpdater.h:105
DtUniqueID uniqueId() const
Get the unique ID of the object.
virtual ~ObjectAttachedPoint()
Definition: DtAttachableUpdater.h:130
DtTaitBryan myWorldOrientationOffset
Definition: DtAttachableUpdater.h:369
AttachedPoint used to attach to a scene object.
Definition: DtAttachableUpdater.h:113
virtual ~VertexAttachedPoint()
Definition: DtAttachableUpdater.h:191
Common base class for all attachments.
Definition: DtAttachableUpdater.h:58
AttachedPointMode myAttachedPointMode
Definition: DtAttachableUpdater.h:108
DtVector vertex() const
Definition: DtAttachableUpdater.h:193
AttachedPointsVector myAttachedPoints
Definition: DtAttachableUpdater.h:363
AttachPoint used to attach to a position provided through the updater interface.
Definition: DtAttachableUpdater.h:181
Scene Object Updater.
Definition: DtSceneObjectUpdater.h:40
DtSceneObjectUpdater * updater() const
Definition: DtAttachableUpdater.h:161
std::vector< AttachedPoint * > AttachedPointsVector
Definition: DtAttachableUpdater.h:362
An abstract base class for objects that require updates. This object automatically adds itself to a D...
Definition: DtTickable.h:26
int secondVtx()
Definition: DtAttachableUpdater.h:225
DtModel * myModel
A pointer to the current model being updated.
Definition: DtAttachableUpdater.h:354
LinearAttachedPoint(DtSceneObject *sceneObject, DtSceneObjectUpdater *updater, int vtx1, int vtx2, double proportion, int targetVertexIndex, const DtVector &positionOffset)
Definition: DtAttachableUpdater.h:209
void setAttachedPointMode(AttachedPointMode mode)
Definition: DtAttachableUpdater.h:93
DtUniqueID DtElementID
The ElementID is a specific type of unique ID used to represent VR-Vantage uniquely defined elements...
Definition: DtUniqueID.h:23
DtSceneObject * mySceneObject
Definition: DtAttachableUpdater.h:174
AttachedPointType
Types of attachments.
Definition: DtAttachableUpdater.h:41
void setPositionOffset(const DtVector &o)
Definition: DtAttachableUpdater.h:83
DtSceneObject * sceneObject() const
Definition: DtAttachableUpdater.h:151
A DtAttachableUpdater updates a scene an object that can be positioned in the scene by (possibly) att...
Definition: DtAttachableUpdater.h:35
DtVector myVertex
Definition: DtAttachableUpdater.h:200
boost::signalslib::connection mySceneObjectUpdaterConnection
Definition: DtAttachableUpdater.h:170
int myTargetVertexIndex
Definition: DtAttachableUpdater.h:106
int firstVtx()
Definition: DtAttachableUpdater.h:220
DtVector myPositionOffset
Definition: DtAttachableUpdater.h:107
void setUpdater(DtSceneObjectUpdater *updater)
Definition: DtAttachableUpdater.h:156
DtVector myWorldPositionOffset
Definition: DtAttachableUpdater.h:368
void setSceneObject(DtSceneObject *sceneObject)
Definition: DtAttachableUpdater.h:132
DtUniqueID myUniqueId
This distributed object&#39;s unique identifier.
Definition: DtAttachableUpdater.h:348
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
AttachedPointMode attachedPointMode() const
Definition: DtAttachableUpdater.h:98
int mySecondVtx
Definition: DtAttachableUpdater.h:238
DtTaitBryan myOrientationOffset
Definition: DtAttachableUpdater.h:366
boost::signalslib::connection mySceneObjectConnection
Definition: DtAttachableUpdater.h:169
ObjectAttachedPoint(DtSceneObject *sceneObject, DtSceneObjectUpdater *updater, int targetVertexIndex, const DtVector &positionOffset)
Definition: DtAttachableUpdater.h:117
boost::signalslib::connection mySceneObjectOrModelConnection
Definition: DtAttachableUpdater.h:359
DtUniqueID mySceneObjectId
Definition: DtAttachableUpdater.h:371
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
Definition: DtAttachableUpdater.h:44
DtUniqueID mySceneObjectId
Definition: DtAttachableUpdater.h:176
AttachPoint used to attach to a point that is proportionally positioned between 2 other points...
Definition: DtAttachableUpdater.h:205
AttachedPoint(AttachedPointType type, int targetVertexIndex, const DtVector &positionOffset)
Definition: DtAttachableUpdater.h:62
AttachedPointType type() const
Definition: DtAttachableUpdater.h:73
Contains the declaration for makVrv::DtTickable.
DtUniqueID sceneObjectId() const
Definition: DtAttachableUpdater.h:146
double proportion()
Definition: DtAttachableUpdater.h:230
VertexAttachedPoint(const DtVector &position, int targetVertexIndex, const DtVector &positionOffset)
Definition: DtAttachableUpdater.h:185
const char int mode
Definition: ioapi.h:38
A DtSceneObject represents an object that can be positioned in the scene by (possibly) attaching it t...
Definition: DtSceneObject.h:44
Definition: DtAttachableUpdater.h:43
A model which owns a single model instance. A DtModel is a managing container for a single DtModelIns...
Definition: DtModel.h:56
Contains makVrv::DtUniqueID type.
DtSceneObject * mySceneObject
A pointer to the current scene object being updated.
Definition: DtAttachableUpdater.h:351
double myProportion
Definition: DtAttachableUpdater.h:239
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:76
DtVector myPositionOffset
Definition: DtAttachableUpdater.h:365
boost::signalslib::connection mySceneObjectUpdaterConnection
Definition: DtAttachableUpdater.h:360
DtModelSetId
Definition: DtModelSetEnums.h:19
voidpf uLong offset
Definition: ioapi.h:42
AttachedPointMode
Definition: DtAttachableUpdater.h:50
int myFirstVtx
Definition: DtAttachableUpdater.h:237
DtDe & myDe
The display engine.
Definition: DtAttachableUpdater.h:345
DtSceneObjectUpdater * myUpdater
Definition: DtAttachableUpdater.h:175
const DtVector & positionOffset() const
Definition: DtAttachableUpdater.h:88
virtual ~AttachedPoint()
Definition: DtAttachableUpdater.h:71
Contains various enum classes relating to model sets.
DtTime lastUpdateTime() const
Definition: DtAttachableUpdater.h:321
Contains makVrv::DtSceneObject class.

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)