VR-Forces 4.1.1 Class Documentation
DtAttachableUpdater.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * Copyright (c) 2012 MAK Technologies, Inc.
3 * All rights reserved.
4 *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
13 #include <vrvCore/DtUniqueID.h>
15 
16 #include <matrix/vlVector.h>
17 #include <matrix/vlTaitBryan.h>
18 
19 #include <vector>
20 #include <list>
21 
22 namespace makVrv
23 {
24 
25  class DtDe;
26 
31  {
32  public:
33 
36  {
41  AttachedPointTypeInvalidObject
42  };
43 
45  {
48  AttachedPointModeOrientationOnly
49  };
50 
53  {
54  public:
55 
56  AttachedPoint( AttachedPointType type, int targetVertexIndex,
57  const DtVector& positionOffset )
58  : myAttachedPointType( type )
59  , myTargetVertexIndex( targetVertexIndex )
60  , myPositionOffset( positionOffset )
61  , myAttachedPointMode(AttachedPointModePositionAndOrientation)
62  {
63  }
64 
65  virtual ~AttachedPoint() {}
66 
67  AttachedPointType type() const
68  {
69  return myAttachedPointType;
70  }
71 
72  int targetVertexIndex()
73  {
74  return myTargetVertexIndex;
75  }
76 
77  void setPositionOffset(const DtVector& o)
78  {
79  myPositionOffset = o;
80  }
81 
82  const DtVector& positionOffset() const
83  {
84  return myPositionOffset;
85  }
86 
87  void setAttachedPointMode( AttachedPointMode mode )
88  {
89  myAttachedPointMode = mode;
90  }
91 
92  AttachedPointMode attachedPointMode() const
93  {
94  return myAttachedPointMode;
95  }
96 
97  protected:
98 
103 
104  };
105 
108  {
109  public:
110 
112  int targetVertexIndex, const DtVector& positionOffset )
113  : AttachedPoint( AttachedPointTypeObject, targetVertexIndex, positionOffset )
114  , mySceneObject( sceneObject )
115  , myUpdater( updater )
116  {
117  }
118 
119  virtual ~ObjectAttachedPoint() {}
120 
121  inline void setSceneObject( DtSceneObject* sceneObject )
122  {
123  mySceneObject = sceneObject;
124  }
125 
126  inline DtSceneObject* sceneObject() const
127  {
128  return mySceneObject;
129  }
130 
131  inline void setUpdater( DtSceneObjectUpdater* updater )
132  {
133  myUpdater = updater;
134  }
135 
136  inline DtSceneObjectUpdater* updater() const
137  {
138  return myUpdater;
139  }
140 
141  protected:
142 
145  };
146 
150  {
151  public:
152 
153  VertexAttachedPoint( const DtVector& position, int targetVertexIndex,
154  const DtVector& positionOffset )
155  : AttachedPoint( AttachedPointTypeVertex, targetVertexIndex, positionOffset )
156  , myVertex( position )
157  {
158  }
159  virtual ~VertexAttachedPoint() {}
160 
161  DtVector vertex() const
162  {
163  return myVertex;
164  }
165 
166  protected:
167 
169  };
170 
174  {
175  public:
176 
178  int vtx1, int vtx2, double proportion, int targetVertexIndex,
179  const DtVector& positionOffset )
180  : ObjectAttachedPoint( sceneObject, updater, targetVertexIndex, positionOffset )
181  , myFirstVtx( vtx1 )
182  , mySecondVtx( vtx2 )
183  , myProportion( proportion )
184  {
185  myAttachedPointType = AttachedPointTypeProportional;
186  }
187 
188  inline int firstVtx()
189  {
190  return myFirstVtx;
191  }
192 
193  inline int secondVtx()
194  {
195  return mySecondVtx;
196  }
197 
198  inline double proportion()
199  {
200  return myProportion;
201  }
202 
203  protected:
204 
207  double myProportion;
208 
209  };
210 
211  public:
212 
214  DtAttachableUpdater( DtDe& de, DtUniqueID id, bool suppressTick = false );
215 
217  virtual ~DtAttachableUpdater();
218 
222  virtual void addAttachedPoint( const DtVector& position, int targetVertexIndex );
223 
227  virtual void addAttachedPoint( DtUniqueID uniqueID, int targetVertexIndex );
228 
232  virtual void addAttachedPoint( DtUniqueID uniqueID, int vtx1, int vtx2,
233  double proportion, int targetVertexIndex );
234 
239  virtual const AttachedPoint& attachedPoint( int targetVertexIndex ) const;
240 
243  virtual void setPositionOffset( const DtVector& offset );
244 
248  virtual void setPositionOffset( const DtVector& offset, int vtx );
249 
252  virtual void setOrientationOffset(const DtTaitBryan& offset);
253 
255  virtual void setAttachedPointMode( unsigned int mode, int vtx );
256 
258  virtual void update( DtTime tNow );
259 
262  virtual void doAttachment( DtTime tNow );
263 
264  protected:
265 
266  virtual void slot_attachedSceneObjectToBeDeleted( const DtUniqueID& );
267  virtual void slot_attachedUpdaterToBeDeleted( const DtUniqueID& id );
268 
269  // get values of attached point at simTime
270  virtual bool pointLocationAndOrientation( AttachedPoint* point,
271  double simTime, DtVector& location, DtTaitBryan& orientation );
272 
274  virtual void removeAttachedPoint(int vtx, DtVector* positionOffset = 0);
275 
276  protected:
277 
278  typedef std::vector<AttachedPoint*> AttachedPointsVector;
280 
282  DtTaitBryan myOrientationOffset;
283 
284  };
285 
286 }

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)