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) 2026 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  {
55  AttachedPointModePositionAndRotateOffset
56  };
57 
60  {
61  public:
62 
63  AttachedPoint( AttachedPointType type, int targetVertexIndex,
64  const DtVector& positionOffset )
65  : myAttachedPointType( type )
66  , myTargetVertexIndex( targetVertexIndex )
67  , myPositionOffset( positionOffset )
68  , myAttachedPointMode(AttachedPointModePositionAndOrientation)
69  {
70  }
71 
72  virtual ~AttachedPoint() {}
73 
75  {
76  return myAttachedPointType;
77  }
78 
80  {
81  return myTargetVertexIndex;
82  }
83 
84  void setPositionOffset(const DtVector& o)
85  {
86  myPositionOffset = o;
87  }
88 
89  const DtVector& positionOffset() const
90  {
91  return myPositionOffset;
92  }
93 
95  {
96  myAttachedPointMode = mode;
97  }
98 
100  {
101  return myAttachedPointMode;
102  }
103 
104  protected:
105 
110 
111  };
112 
115  {
116  public:
117 
119  int targetVertexIndex, const DtVector& positionOffset )
120  : AttachedPoint( AttachedPointTypeObject, targetVertexIndex, positionOffset )
121  , mySceneObject( sceneObject )
122  , myUpdater( updater )
123  , mySceneObjectId( 0 )
124  {
125  if( sceneObject )
126  {
127  mySceneObjectId = sceneObject->uniqueId();
128  }
129  }
130 
131  virtual ~ObjectAttachedPoint() {}
132 
133  inline void setSceneObject( DtSceneObject* sceneObject )
134  {
135  mySceneObject = sceneObject;
136 
137  if (sceneObject)
138  {
139  mySceneObjectId = sceneObject->uniqueId();
140  }
141  else
142  {
143  mySceneObjectId = 0;
144  }
145  }
146 
147  inline DtUniqueID sceneObjectId() const
148  {
149  return mySceneObjectId;
150  }
151 
152  inline DtSceneObject* sceneObject() const
153  {
154  return mySceneObject;
155  }
156 
157  inline void setUpdater( DtSceneObjectUpdater* updater )
158  {
159  myUpdater = updater;
160  }
161 
162  inline DtSceneObjectUpdater* updater() const
163  {
164  return myUpdater;
165  }
166 
167  // When the class is destructed, the scene object may or may not
168  // exist. Using a separate connection variable makes it possible to
169  // 'disconnect' even if the scene object has been deleted.
170  boost::signalslib::connection mySceneObjectConnection;
171  boost::signalslib::connection mySceneObjectUpdaterConnection;
172 
173  protected:
174 
178  };
179 
183  {
184  public:
185 
186  VertexAttachedPoint( const DtVector& position, int targetVertexIndex,
187  const DtVector& positionOffset )
188  : AttachedPoint( AttachedPointTypeVertex, targetVertexIndex, positionOffset )
189  , myVertex( position )
190  {
191  }
192  virtual ~VertexAttachedPoint() {}
193 
194  DtVector vertex() const
195  {
196  return myVertex;
197  }
198 
199  protected:
200 
201  DtVector myVertex;
202  };
203 
207  {
208  public:
209 
211  int vtx1, int vtx2, double proportion, int targetVertexIndex,
212  const DtVector& positionOffset )
213  : ObjectAttachedPoint( sceneObject, updater, targetVertexIndex, positionOffset )
214  , myFirstVtx( vtx1 )
215  , mySecondVtx( vtx2 )
216  , myProportion( proportion )
217  {
218  myAttachedPointType = AttachedPointTypeProportional;
219  }
220 
221  inline int firstVtx()
222  {
223  return myFirstVtx;
224  }
225 
226  inline int secondVtx()
227  {
228  return mySecondVtx;
229  }
230 
231  inline double proportion()
232  {
233  return myProportion;
234  }
235 
236  protected:
237 
240  double myProportion;
241 
242  };
243 
244  public:
245 
248 
250  virtual ~DtAttachableUpdater();
251 
253  virtual bool needsUpdate( DtTime tNow );
254 
258  virtual void addAttachedPoint( const DtVector& position, int targetVertexIndex );
259 
263  virtual void addAttachedPoint( DtUniqueID sceneObjectId, int targetVertexIndex );
264 
268  virtual void addAttachedPoint( DtElementID elementId, DtModelSetId modelSet, int targetVertexIndex );
269 
273  virtual void addAttachedPoint( DtUniqueID sceneObjectId, int vtx1, int vtx2,
274  double proportion, int targetVertexIndex );
275 
280  virtual const AttachedPoint& attachedPoint( int targetVertexIndex ) const;
281 
284  virtual void setPositionOffset( const DtVector& offset );
285 
289  virtual void setWorldPositionOffset( const DtVector& offset );
290 
294  virtual void setPositionOffset( const DtVector& offset, int vtx );
295 
298  virtual void setOrientationOffset(const DtTaitBryan& offset);
299 
302  virtual void setWorldOrientationOffset(const DtTaitBryan& offset);
303 
305  virtual void setAttachedPointMode( unsigned int mode, int vtx );
306 
308  virtual void update( DtTime tNow );
309 
312  virtual void setSceneObject( DtSceneObject* sceneObject );
313 
316  virtual void setModel( DtModel* model );
317 
320  virtual void doAttachment( DtTime tNow );
321 
322  inline DtTime lastUpdateTime() const
323  {
324  return myLastUpdateTime;
325  }
326 
327  protected:
328 
331  virtual void slot_sceneObjectToBeDeleted( const DtUniqueID& id );
332  virtual void slot_modelToBeDeleted( DtModel* model );
333  virtual void slot_attachedSceneObjectToBeDeleted( const DtUniqueID& );
334  virtual void slot_attachedUpdaterToBeDeleted( const DtUniqueID& id );
336 
337  // get values of attached point at simTime
338  virtual bool pointLocationAndOrientation( AttachedPoint* point,
339  double simTime, DtVector& location, DtTaitBryan& orientation );
340 
342  virtual void removeAttachedPoint(int vtx, DtVector* positionOffset = 0);
343 
347  virtual void setVertexOrientation(int vtx, const DtTaitBryan& orientation);
348  virtual void setVertexPosition(int vtx, const DtVector& position);
349  protected:
352 
355 
358 
361 
362  // When the class is destructed, the scene object may or may not
363  // exist. Using a separate connection variable makes it possible to
364  // 'disconnect' even if the scene object has been deleted.
365  boost::signalslib::connection mySceneObjectOrModelConnection;
366  boost::signalslib::connection mySceneObjectUpdaterConnection;
367 
368  typedef std::vector<AttachedPoint*> AttachedPointsVector;
370 
372  DtTaitBryan myOrientationOffset;
373 
376 
378  };
379 }
int targetVertexIndex()
Definition: DtAttachableUpdater.h:79
AttachedPointType myAttachedPointType
Definition: DtAttachableUpdater.h:106
DtUniqueID uniqueId() const
Get the unique ID of the object.
virtual ~ObjectAttachedPoint()
Definition: DtAttachableUpdater.h:131
DtTaitBryan myWorldOrientationOffset
Definition: DtAttachableUpdater.h:375
AttachedPoint used to attach to a scene object.
Definition: DtAttachableUpdater.h:114
virtual ~VertexAttachedPoint()
Definition: DtAttachableUpdater.h:192
Common base class for all attachments.
Definition: DtAttachableUpdater.h:59
AttachedPointMode myAttachedPointMode
Definition: DtAttachableUpdater.h:109
DtVector vertex() const
Definition: DtAttachableUpdater.h:194
AttachedPointsVector myAttachedPoints
Definition: DtAttachableUpdater.h:369
AttachPoint used to attach to a position provided through the updater interface.
Definition: DtAttachableUpdater.h:182
Scene Object Updater.
Definition: DtSceneObjectUpdater.h:40
DtSceneObjectUpdater * updater() const
Definition: DtAttachableUpdater.h:162
std::vector< AttachedPoint * > AttachedPointsVector
Definition: DtAttachableUpdater.h:368
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:226
DtModel * myModel
A pointer to the current model being updated.
Definition: DtAttachableUpdater.h:360
LinearAttachedPoint(DtSceneObject *sceneObject, DtSceneObjectUpdater *updater, int vtx1, int vtx2, double proportion, int targetVertexIndex, const DtVector &positionOffset)
Definition: DtAttachableUpdater.h:210
void setAttachedPointMode(AttachedPointMode mode)
Definition: DtAttachableUpdater.h:94
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:175
AttachedPointType
Types of attachments.
Definition: DtAttachableUpdater.h:41
void setPositionOffset(const DtVector &o)
Definition: DtAttachableUpdater.h:84
DtSceneObject * sceneObject() const
Definition: DtAttachableUpdater.h:152
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:201
boost::signalslib::connection mySceneObjectUpdaterConnection
Definition: DtAttachableUpdater.h:171
int myTargetVertexIndex
Definition: DtAttachableUpdater.h:107
int firstVtx()
Definition: DtAttachableUpdater.h:221
DtVector myPositionOffset
Definition: DtAttachableUpdater.h:108
void setUpdater(DtSceneObjectUpdater *updater)
Definition: DtAttachableUpdater.h:157
DtVector myWorldPositionOffset
Definition: DtAttachableUpdater.h:374
void setSceneObject(DtSceneObject *sceneObject)
Definition: DtAttachableUpdater.h:133
DtUniqueID myUniqueId
This distributed object&#39;s unique identifier.
Definition: DtAttachableUpdater.h:354
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
AttachedPointMode attachedPointMode() const
Definition: DtAttachableUpdater.h:99
int mySecondVtx
Definition: DtAttachableUpdater.h:239
DtTaitBryan myOrientationOffset
Definition: DtAttachableUpdater.h:372
boost::signalslib::connection mySceneObjectConnection
Definition: DtAttachableUpdater.h:170
ObjectAttachedPoint(DtSceneObject *sceneObject, DtSceneObjectUpdater *updater, int targetVertexIndex, const DtVector &positionOffset)
Definition: DtAttachableUpdater.h:118
boost::signalslib::connection mySceneObjectOrModelConnection
Definition: DtAttachableUpdater.h:365
DtUniqueID mySceneObjectId
Definition: DtAttachableUpdater.h:377
unsigned long long DtUniqueID
Definition: DtUniqueID.h:19
Definition: DtAttachableUpdater.h:44
DtUniqueID mySceneObjectId
Definition: DtAttachableUpdater.h:177
AttachPoint used to attach to a point that is proportionally positioned between 2 other points...
Definition: DtAttachableUpdater.h:206
AttachedPoint(AttachedPointType type, int targetVertexIndex, const DtVector &positionOffset)
Definition: DtAttachableUpdater.h:63
AttachedPointType type() const
Definition: DtAttachableUpdater.h:74
Contains the declaration for makVrv::DtTickable.
DtUniqueID sceneObjectId() const
Definition: DtAttachableUpdater.h:147
double proportion()
Definition: DtAttachableUpdater.h:231
VertexAttachedPoint(const DtVector &position, int targetVertexIndex, const DtVector &positionOffset)
Definition: DtAttachableUpdater.h:186
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:57
Contains makVrv::DtUniqueID type.
DtSceneObject * mySceneObject
A pointer to the current scene object being updated.
Definition: DtAttachableUpdater.h:357
double myProportion
Definition: DtAttachableUpdater.h:240
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:371
boost::signalslib::connection mySceneObjectUpdaterConnection
Definition: DtAttachableUpdater.h:366
DtModelSetId
Definition: DtModelSetEnums.h:19
voidpf uLong offset
Definition: ioapi.h:42
AttachedPointMode
Definition: DtAttachableUpdater.h:50
int myFirstVtx
Definition: DtAttachableUpdater.h:238
DtDe & myDe
The display engine.
Definition: DtAttachableUpdater.h:351
DtSceneObjectUpdater * myUpdater
Definition: DtAttachableUpdater.h:176
const DtVector & positionOffset() const
Definition: DtAttachableUpdater.h:89
virtual ~AttachedPoint()
Definition: DtAttachableUpdater.h:72
Contains various enum classes relating to model sets.
DtTime lastUpdateTime() const
Definition: DtAttachableUpdater.h:322
Contains makVrv::DtSceneObject class.

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)