VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtOsgObserverObject.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2013 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
13 
15 
16 #include <boost/unordered_map.hpp>
17 
18 #include <osg/Matrixd>
19 #include <osg/Vec3d>
20 #include <osg/Vec3>
21 
22 #include <list>
23 
24 class DtTaitBryan;
25 
26 namespace osg
27 {
28  class Node;
29 }
30 
31 namespace makVrv
32 {
33  class DtChannel;
34  class DtOsgChannel;
36  class DtSceneObject;
37  class DtTerrainPatchObject;
38  class DtAgentUpdateResolverInterface;
39 
44  {
45 
46  public:
47 
49  {
50  TerrainResultNoData = 0,
52  TerrainResultComplete
53  };
54 
56  DtOsgObserverObject( DtDe& de, DtUniqueID id, const std::string& name="" );
57 
59  virtual ~DtOsgObserverObject();
60 
62  virtual void tick( double simTime );
63 
65  virtual void tickAttachment();
66 
69  virtual void setModelSet( int modelSet );
70 
72  virtual double altitude() const;
73 
74  virtual void setNameAndRegister( const std::string& name );
75 
76  virtual void getCameraPositionAndOrientation( osg::Vec3d& position,
77  osg::Quat& rotation ) const;
78 
80  static void matrixdToTaitBryan( const osg::Matrixd& mat, DtTaitBryan& tb, bool isWorld2D = false );
81  static double clampUnity( double x );
82 
83 
84  //
85  //
87  //
88  //
89 
91 
92 
93  virtual void startMoveObserverRight();
94  virtual void stopMoveObserverRight();
95  virtual void moveObserverRight( double meters );
96 
98 
99 
100  virtual void startMoveObserverForward();
101  virtual void stopMoveObserverForward();
102  virtual void moveObserverForward( double meters );
104 
106 
107 
108  virtual void startMoveObserverUp();
109  virtual void stopMoveObserverUp();
110  virtual void moveObserverUp( double meters );
112 
114 
115 
116  virtual void startMoveObserverLeft();
117  virtual void stopMoveObserverLeft();
118  virtual void moveObserverLeft( double meters );
120 
122 
123 
124  virtual void startMoveObserverBack();
125  virtual void stopMoveObserverBack();
126  virtual void moveObserverBack( double meters );
128 
130 
131 
132  virtual void startMoveObserverDown();
133  virtual void stopMoveObserverDown();
134  virtual void moveObserverDown( double meters );
136 
138 
139 
140 
141  virtual void startMoveLevelObserverRight();
142  virtual void stopMoveLevelObserverRight();
143  virtual void moveLevelObserverRight( double meters );
145 
147 
148 
149 
150  virtual void startMoveLevelObserverForward();
151  virtual void stopMoveLevelObserverForward();
152  virtual void moveLevelObserverForward( double meters );
154 
156 
157 
158 
159  virtual void startMoveLevelObserverUp();
160  virtual void stopMoveLevelObserverUp();
161  virtual void moveLevelObserverUp( double meters );
163 
165 
166 
167 
168  virtual void startMoveLevelObserverLeft();
169  virtual void stopMoveLevelObserverLeft();
170  virtual void moveLevelObserverLeft( double meters );
172 
174 
175 
176 
177  virtual void startMoveLevelObserverBack();
178  virtual void stopMoveLevelObserverBack();
179  virtual void moveLevelObserverBack( double meters );
181 
183 
184 
185  virtual void startMoveLevelObserverDown();
186  virtual void stopMoveLevelObserverDown();
187  virtual void moveLevelObserverDown( double meters );
189 
191 
192 
193  virtual void startMoveAttachedRight();
194  virtual void stopMoveAttachedRight();
195  virtual void moveAttachedRight( double meters );
196 
198 
199 
200  virtual void startMoveAttachedForward();
201  virtual void stopMoveAttachedForward();
202  virtual void moveAttachedForward( double meters );
204 
206 
207 
208  virtual void startMoveAttachedUp();
209  virtual void stopMoveAttachedUp();
210  virtual void moveAttachedUp( double meters );
212 
214 
215 
216  virtual void startMoveAttachedLeft();
217  virtual void stopMoveAttachedLeft();
218  virtual void moveAttachedLeft( double meters );
220 
222 
223 
224  virtual void startMoveAttachedBack();
225  virtual void stopMoveAttachedBack();
226  virtual void moveAttachedBack( double meters );
228 
230 
231 
232  virtual void startMoveAttachedDown();
233  virtual void stopMoveAttachedDown();
234  virtual void moveAttachedDown( double meters );
236 
238 
239 
240 
241  virtual void startMoveLevelAttachedRight();
242  virtual void stopMoveLevelAttachedRight();
243  virtual void moveLevelAttachedRight( double meters );
245 
247 
248 
249 
250  virtual void startMoveLevelAttachedForward();
251  virtual void stopMoveLevelAttachedForward();
252  virtual void moveLevelAttachedForward( double meters );
254 
256 
257 
258 
259  virtual void startMoveLevelAttachedUp();
260  virtual void stopMoveLevelAttachedUp();
261  virtual void moveLevelAttachedUp( double meters );
263 
265 
266 
267 
268  virtual void startMoveLevelAttachedLeft();
269  virtual void stopMoveLevelAttachedLeft();
270  virtual void moveLevelAttachedLeft( double meters );
272 
274 
275 
276 
277  virtual void startMoveLevelAttachedBack();
278  virtual void stopMoveLevelAttachedBack();
279  virtual void moveLevelAttachedBack( double meters );
281 
283 
284 
285  virtual void startMoveLevelAttachedDown();
286  virtual void stopMoveLevelAttachedDown();
287  virtual void moveLevelAttachedDown( double meters );
289 
291 
292 
293  virtual void startMoveAttachedContextRight();
294  virtual void stopMoveAttachedContextRight();
295  virtual void moveAttachedContextRight( double meters );
297 
299 
300 
301  virtual void startMoveAttachedContextForward();
302  virtual void stopMoveAttachedContextForward();
303  virtual void moveAttachedContextForward( double meters );
305 
307 
308 
309  virtual void startMoveAttachedContextUp();
310  virtual void stopMoveAttachedContextUp();
311  virtual void moveAttachedContextUp( double meters );
313 
315 
316 
317  virtual void startMoveAttachedContextLeft();
318  virtual void stopMoveAttachedContextLeft();
319  virtual void moveAttachedContextLeft( double meters );
321 
323 
324 
325  virtual void startMoveAttachedContextBack();
326  virtual void stopMoveAttachedContextBack();
327  virtual void moveAttachedContextBack( double meters );
329 
331 
332  virtual void startMoveAttachedContextDown();
333  virtual void stopMoveAttachedContextDown();
334  virtual void moveAttachedContextDown( double meters );
336 
338 
339 
340  virtual void startYawLeft();
341  virtual void stopYawLeft();
343 
345 
346 
347 
348  virtual void startYawRight();
349  virtual void stopYawRight();
351 
353 
354 
355  virtual void startPitchUp();
356  virtual void stopPitchUp();
357  virtual void rotatePitchUp( double rads );
359 
361 
362 
363  virtual void startPitchDown();
364  virtual void stopPitchDown();
365  virtual void rotatePitchDown( double rads );
367 
369 
370 
371  virtual void startRollLeft();
372  virtual void stopRollLeft();
374 
376 
377 
378  virtual void startRollRight();
379  virtual void stopRollRight();
381 
383 
384 
385  virtual void startLevelYawLeft();
386  virtual void stopLevelYawLeft();
388 
390 
391 
392 
393  virtual void startLevelYawRight();
394  virtual void stopLevelYawRight();
396 
398 
399 
400  virtual void startLevelPitchUp();
401  virtual void stopLevelPitchUp();
403 
405 
406 
407  virtual void startLevelPitchDown();
408  virtual void stopLevelPitchDown();
410 
412 
413 
414  virtual void startLevelRollLeft();
415  virtual void stopLevelRollLeft();
417 
419 
420 
421  virtual void startLevelRollRight();
422  virtual void stopLevelRollRight();
424 
425  virtual void rotateLevelYawLeft( double rads );
426  virtual void rotateLevelYawRight( double rads );
427 
428  virtual void startLookLeft();
429  virtual void stopLookLeft();
430  virtual void lookLeft( double rads );
431 
432  virtual void startLookRight();
433  virtual void stopLookRight();
434  virtual void lookRight( double rads );
435 
436  virtual void startLookUp();
437  virtual void stopLookUp();
438  virtual void lookUp( double rads );
439 
440  virtual void startLookDown();
441  virtual void stopLookDown();
442  virtual void lookDown( double rads );
443 
444  virtual void startLookTiltRight();
445  virtual void stopLookTiltRight();
446  virtual void lookTiltRight( double rads );
447 
448  virtual void startLookTiltLeft();
449  virtual void stopLookTiltLeft();
450  virtual void lookTiltLeft( double rads );
451 
453 
454 
455  virtual void startOrbitingLeft();
456  virtual void stopOrbitingLeft();
457  virtual void orbitLeft( double rads );
459 
461 
462 
463  virtual void startOrbitingRight();
464  virtual void stopOrbitingRight();
465  virtual void orbitRight( double rads );
467 
469 
470 
471  virtual void startOrbitingUp();
472  virtual void stopOrbitingUp();
473  virtual void orbitUp( double rads );
475 
477 
478 
479  virtual void startOrbitingDown();
480  virtual void stopOrbitingDown();
481  virtual void orbitDown( double rads );
483 
485  virtual void setLocation( double x, double y, double z);
486 
490  virtual void setAttachedLocation( double x, double y, double z );
491 
493  virtual void setOrientation( double psi, double theta, double phi );
494 
496  virtual void setOrientation( double x, double y, double z, double w);
497 
499  virtual void setAttachedOrientation( double psi, double theta, double phi );
500 
502  virtual void setAttachedOrientation( double x, double y, double z,
503  double w);
504 
507  void setLocalModelScalingEnabled( bool enabled );
508 
511  void setLocalModelScalingAmount( float amount );
512 
515  virtual void jumpTo( double x, double y, double z );
516 
518  virtual void jumpTo( DtUniqueID elementID );
519 
520  virtual void orientTo( double x, double y, double z );
521 
523  virtual void dragTerrain( double lastX, double lastY, double lastZ,
524  double currX, double currY, double currZ );
525 
526  virtual void dragTerrain2( double myStartDragX, double myStartDragY,
527  double myStartDragZ, int deltaMouseX, int deltaMouseY );
528 
529  virtual void dragGravityUp( double windowUnits );
530  virtual void dragGravityDown( double windowUnits );
531  virtual void dragGravityLeft( double windowUnits );
532  virtual void dragGravityRight( double windowUnits );
533  virtual void scrollObserverForward( int wheelUnits );
534  virtual void scrollObserverBack( int wheelUnits );
535  virtual void scrollLevelObserverForward( int wheelUnits );
536  virtual void scrollLevelObserverBack( int wheelUnits );
537 
538  //{@
540  virtual void startIncreasingViewResolution();
541  virtual void stopIncreasingViewResolution();
542  virtual void increaseViewResolution();
543 
544  virtual void startDecreasingViewResolution();
545  virtual void stopDecreasingViewResolution();
546  virtual void decreaseViewResolution();
547 
548  // Sets the view resolution in meters per pixel.
549  virtual void setViewResolution( double resolution);
550 
551  // Get the current view resolution.
552  virtual double viewResolution() const;
553 
555  virtual void setViewMagnification( double mag );
556 
558  virtual double viewMagnification() const;
559 
561 
562  //
564  //
565 
567  virtual void setOrbitSpeed( double speed );
568 
570  virtual void setLinearSpeed( double speed );
571 
573  virtual void setRotationSpeed( double speed );
574 
576  virtual void setMinLinearSpeed( double minSpeed );
577 
579  virtual void setLinearScaledSpeedGain( double gain );
580 
586  virtual void gotoTerrainCenter( DtUniqueID terrainPatch, bool retry );
587 
589  virtual void resetAttachment();
590 
591  virtual void resetOrientation();
592 
594  virtual void resetCamera();
595  virtual void level();
596 
597  virtual void stopAll();
598 
599  virtual void attachToObjects( const std::vector<DtUniqueID>& elementIds );
600  virtual void setSecondaryAttachment( const std::vector<DtUniqueID>& elementIds );
601  virtual void attachToPart( int partId);
602  virtual void detach();
603  virtual void setAttachType( DtObserverObject::AttachType type );
604  virtual void setHideModelOnAttach( bool hide );
605  virtual void scaleCurrentAttachments( bool scaled );
606  virtual void setOrientToTargetConstraint( bool orient );
607  virtual void setOrbiting( bool orbit );
608  virtual void setOrientCameraToTargetConstraint( bool orient );
609 
610  virtual void setConstrainToTerrain( bool trueFalse );
611  virtual void setConstrainToCenter( bool trueFalse );
612 
615  virtual void suppressConstrainToTerrain( bool trueFalse );
616 
617  virtual void setSpeedScaling( bool trueFalse );
618 
620  virtual void setSpeedScaledSpeed( double speed );
621 
622  virtual void getLocation( double &x, double &y, double& z ) const;
623 
624  virtual void getOrientation( double& psi, double& theta, double& phi ) const;
625 
626  virtual void getOrientation( double& x, double& y, double& z, double& w ) const;
627 
628 
632  virtual double fixed2DAltitude();
633 
636  virtual double heightAboveTerrainFromCurrentZoom();
637 
640  virtual double topographicHeading() const;
641 
643  virtual void getLinearVelocity(double &x, double &y, double &z) const;
644 
646  virtual void getRotationalVelocity( double& x, double& y, double& z) const;
647 
651  virtual void setModeSetting( int setting, bool value );
652 
654  virtual std::vector<DtUniqueID> currentAttachments() const;
655 
659  virtual DtObserverObject::AttachType attachType3D() const;
660 
664  virtual DtObserverObject::AttachType attachType2D() const;
665 
667  virtual bool attachedObjectHidden() const;
668 
671  virtual osg::Vec3d attachedOffsetVector() const;
672 
677  virtual double attachedNearClipOffset() const;
678 
680  virtual double heightAboveTerrain() const;
681  private:
682 
685 
687  DtOsgObserverObject& operator=( const DtOsgObserverObject& );
688 
689  protected:
690 
692  virtual bool shouldOrientToGlobeCenter();
693 
695  virtual void adjustToGlobeCurvature();
696 
698  virtual bool shouldRotateGlobe();
699 
702  virtual double zoomFromCurrentAltitude();
703 
706  virtual double altitudeFromCurrentZoom();
707 
708  virtual void calcObserverWorldVectors();
709  virtual const osg::Vec3d& observerWorldUp() const;
710  virtual const osg::Vec3d& observerWorldNorth() const;
711  virtual const osg::Vec3d& observerWorldEast() const;
712 
713  virtual const osg::Vec3d& attachedWorldUp() const;
714 
715  virtual osg::Vec3d& observerUp();
716  virtual osg::Vec3d& observerFront();
717  virtual osg::Vec3d& observerRight();
718 
719  virtual osg::Vec3d& attachedUp();
720  virtual osg::Vec3d& attachedFront();
721  virtual osg::Vec3d& attachedRight();
722 
723  virtual osg::Vec3d& attachedOffsetUp();
724  virtual osg::Vec3d& attachedOffsetFront();
725  virtual osg::Vec3d& attachedOffsetRight();
726 
728  virtual osg::Vec3d& levelAttachedUp();
729  virtual osg::Vec3d& levelAttachedFront();
730  virtual osg::Vec3d& levelAttachedRight();
731 
733  virtual osg::Vec3d& levelObserverMimicUp();
734  virtual osg::Vec3d& levelObserverMimicFront();
735  virtual osg::Vec3d& levelObserverMimicRight();
736 
737  virtual osg::Vec3d& cameraUp();
738  virtual osg::Vec3d& cameraFront();
739  virtual osg::Vec3d& cameraRight();
740 
741  virtual osg::Vec3d& levelObserverUp();
742  virtual osg::Vec3d& levelObserverFront();
743  virtual osg::Vec3d& levelObserverRight();
744 
745  virtual void advanceOrbitLeft( double rads );
746  virtual void advanceOrbitRight( double rads );
747  virtual void advanceOrbitUp( double rads );
748  virtual void advanceOrbitDown( double rads );
749 
750  virtual void makeLevelObserverMatrix();
751 
753  virtual void calculateLevelAttachedRotation();
754 
756  virtual void makeLevelObserverMimicMatrix();
757 
761  virtual osg::Vec3d calcWorldPositionChange();
762 
763  virtual osg::Vec3d calcMimicPositionChange();
764  virtual osg::Vec3d calcFollowPositionChange();
765  virtual osg::Vec3d calcSpaceFollowPositionChange();
766  virtual osg::Vec3d calcTetherPositionChange();
767  virtual osg::Vec3d calcTetherTrackPositionChange();
768  virtual osg::Vec3d calcTrackPositionChange();
769  virtual osg::Quat calcTetherTrackRotation();
770 
771  virtual osg::Quat calcWorldOrientationChange();
772  virtual osg::Quat calcTetherOrientationChange();
773  virtual osg::Quat calcMimicOrientationChange();
774  virtual osg::Quat calcFollowOrientationChange();
775 
776  virtual void setCurrentAttachmentsVisibility( bool visible );
777 
784 
787  virtual void orientTo( const osg::Vec3d& target );
788 
790  virtual void orientCameraTo( const osg::Vec3d& target );
791 
792  virtual TerrainResult getTerrainCenter( const DtUniqueID& patchID, osg::Vec3d& center );
793 
794  virtual DtCoordinateConverter& coordinateConverter();
795  virtual const DtCoordinateConverter& coordinateConverter() const;
796 
797  virtual void initializeAttachment();
798 
799  virtual void getScalingIntersection();
800  virtual void getViewIntersection();
801 
803  virtual double linearSpeed();
804 
806  virtual double speedScalingGain() const;
807 
808  virtual void calcTerrainConstraint( osg::Vec3d prev );
809 
815  virtual bool updateAttachPositionAndOrientation();
816 
817  virtual bool getSecondaryAttachPosition( osg::Vec3d& position );
818 
819  virtual void getObserverOffsetVector( double& x, double& y, double& z ) const;
820  virtual void setObserverOffsetVector( double x, double y, double z );
821 
822  virtual void getAttachedRotationOffset( double& x, double& y, double& z, double& w ) const;
823  virtual void setAttachedRotationOffset( double x, double y, double z,
824  double w );
825 
826  virtual void getBoundingVolume( DtSceneObject& sceneObject,
827  osg::Vec3& bvolExtents, osg::Vec3d& bvolCenter );
828 
829  virtual void getBoundingVolume( DtTerrainPatchObject& patchObject,
830  osg::Vec3& bvolExtents, osg::Vec3d& bvolCenter );
831 
832  virtual void setLocation( const osg::Vec3d& location, bool suppress=true );
833 
834  virtual bool isMoving() const;
835  virtual bool isRotating() const;
836 
837  virtual double computeNearClipDistance( DtSceneObject* sceneObject );
838  virtual float computeLocalModelScalingAmount( DtSceneObject* sceneObject );
839 
840  virtual void calcScaledSpeed();
841  virtual bool getTerrainOrPropIntersection( const osg::Vec3d& startPos,
842  const osg::Vec3d& endPos, osg::Vec3d& result ) const;
843 
845  virtual DtSceneObject* findSceneObjectFromElement(const DtElementID& id);
846 
848  virtual DtTerrainPatchObject* findTerrainPatchObjectFromElement( const DtElementID& id );
849 
850  virtual void getPositionAndOrientation( DtSceneObject& sceneObject, osg::Vec3d& position,
851  osg::Vec3d& orientToPosition, osg::Quat& orientation );
852 
853  virtual void getPositionAndOrientation( DtTerrainPatchObject& patchObject, osg::Vec3d& position,
854  osg::Vec3d& orientToPosition, osg::Quat& orientation );
855 
857  virtual void getPositionFromSceneObject( DtSceneObject& sceneObject, osg::Vec3d& position ) const;
858 
861  virtual bool getPartPositionOriFromSceneObject( DtSceneObject& sceneObject,
862  int partId, osg::Vec3d& position, osg::Quat& ori ) const;
863 
866  virtual void force2D();
867 
869  virtual void dimensionChanged( bool is2D );
870  virtual void setIs2D( bool is2D );
871 
873  virtual double calculate3DAltitude() const;
874 
876  virtual void calculateAltitude();
877 
880  virtual double zoomFromAltitude( double altitude );
881 
884  virtual double zoomFromHeightAboveTerrain( double hat );
885 
886  virtual double calcEarthRadiusAtLocalCoord( const osg::Vec3d& local ) const;
887 
888  // Sends the location of the observer on the master to all others; only used
889  // if different
890  virtual void synchronizeLocation( double x, double y, double z );
891 
892  // Sends the orientation of the observer on the master to all others; only used
893  // if different
894  virtual void synchronizeOrientation( double x, double y, double z, double w );
895 
896  virtual void calcHeightAboveTerrain();
897 
898  // Utility function that returns the list of channels whose observer is
899  // this observer
900  std::list<DtChannel*> findChannels();
901 
902  // This is calculated based on channel parameters. It replaces the old
903  // theZoomAltitudeConstant, which was an approximation
904  double heightToZoomRatio();
905 
906  protected:
907 
908  static const double theObserverBoundingSphere;
910 
911  static const double theMaxTerrainRetryTime;
912 
913  // below this altitude, ignore myConstrainToCenter
914  static const double theCenterConstrainHeight;
915 
916  // Zoom won't get any smaller than this
917  static const double theMinViewResolution;
918 
919  // Zoom won't get any larger than this
920  static const double theMaxViewResolution;
921 
922 
923  protected:
924 
925  std::vector<DtUniqueID> myCurrentAttachments;
926  std::vector<DtUniqueID> mySecondaryAttachments;
928 
929  bool myChanged;
931 
932  //
934  //
943 
946 
949 
952 
954  osg::Vec3d myObserverPosition;
955 
958 
959  osg::Vec3d myAttachedPosition;
960 
962 
964  osg::Vec3d myDragMove;
965 
966  osg::Vec3d myOrientToPosition;
967 
968  osg::Vec3d myOrbitAdvance;
969 
975 
978 
981  osg::Quat myMasterRotation;
982 
985 
990 
993 
996 
999 
1003 
1004  //bool myGlobeObserverMode;
1007 
1010 
1012  {
1013  public:
1014 
1016  {
1017  Stopped = 0,
1018  Forward = 1,
1019  Backward = 2,
1020  Left = 4,
1021  Right = 8,
1022  Up = 16,
1023  Down = 32
1024  };
1025 
1027  : myState(Stopped)
1028  {
1029  }
1030 
1032  inline void applyMovement(double linearDistance)
1033  {
1034  if(moving(Right)) myAdvance[0] += linearDistance;
1035  if(moving(Left)) myAdvance[0] -= linearDistance;
1036  if(moving(Forward)) myAdvance[1] += linearDistance;
1037  if(moving(Backward)) myAdvance[1] -= linearDistance;
1038  if(moving(Up)) myAdvance[2] += linearDistance;
1039  if(moving(Down)) myAdvance[2] -= linearDistance;
1040  }
1041 
1043  inline const osg::Vec3d& advance() const
1044  {
1045  return myAdvance;
1046  }
1047 
1048  inline void stop()
1049  {
1050  myState = Stopped;
1051  myAdvance.set(0.0,0.0,0.0);
1052  myEuler.set(0.0,0.0,0.0);
1053  }
1054 
1055  inline void clearAdvance()
1056  {
1057  myAdvance.set(0.0,0.0,0.0);
1058  }
1059 
1060  inline bool stopped()
1061  {
1062  return myState == Stopped;
1063  }
1064 
1065  inline bool moving() const
1066  {
1067  return myState != Stopped;
1068  }
1069 
1070  inline bool moving(Direction d) const
1071  {
1072  return (myState & d) != 0;
1073  }
1074 
1075  inline void setMoving(Direction d, bool moving)
1076  {
1077  myState = moving ? myState | d : myState & ~d;
1078  }
1079 
1080  enum Angle
1081  {
1082  YawLeft = 1,
1083  YawRight = 2,
1084  PitchUp = 4,
1085  PitchDown = 8,
1086  RollLeft = 16,
1087  RollRight = 32
1088  };
1089 
1090  inline void applyRotation(double angle)
1091  {
1092  if(rotating(YawRight)) myEuler[0] -= angle;
1093  if(rotating(YawLeft)) myEuler[0] += angle;
1094  if(rotating(PitchUp)) myEuler[1] += angle;
1095  if(rotating(PitchDown)) myEuler[1] -= angle;
1096  if(rotating(RollRight)) myEuler[2] += angle;
1097  if(rotating(RollLeft)) myEuler[2] -= angle;
1098  }
1099 
1100  inline const osg::Vec3d& euler() const
1101  {
1102  return myEuler;
1103  }
1104 
1105  inline osg::Vec3d& euler()
1106  {
1107  return myEuler;
1108  }
1109 
1110  inline void level()
1111  {
1112  myEuler.set(0.0,0.0,0.0);
1113  }
1114 
1115  inline bool rotating() const
1116  {
1117  return myState != Stopped;
1118  }
1119 
1120  inline bool rotating( Angle d ) const
1121  {
1122  return (myState & d) != 0;
1123  }
1124 
1125  inline void setRotating( Angle d, bool rotating )
1126  {
1127  myState = rotating ? myState | d : myState & ~d;
1128  }
1129 
1130  protected:
1131 
1135  osg::Vec3d myAdvance;
1136  osg::Vec3d myEuler;
1137 
1138  unsigned char myState;
1139  };
1140 
1145 
1150 
1155 
1159 
1165 
1169 
1170  //
1179 
1183 
1187 
1189  osg::Vec3d myCameraOffset;
1191  osg::Quat myCameraRotation;
1192 
1193  osg::Vec3d myObserverWorldUp;
1196 
1197  osg::Vec3d myAttachedWorldUp;
1200 
1201  osg::Vec3d myObserverUp;
1202  osg::Vec3d myObserverFront;
1203  osg::Vec3d myObserverRight;
1204 
1205  osg::Vec3d myLevelObserverUp;
1208 
1209  osg::Vec3d myAttachedUp;
1210  osg::Vec3d myAttachedFront;
1211  osg::Vec3d myAttachedRight;
1212 
1213  osg::Vec3d myLevelAttachedUp;
1216 
1220 
1224 
1225  osg::Vec3d myCameraUp;
1226  osg::Vec3d myCameraFront;
1227  osg::Vec3d myCameraRight;
1228 
1231 
1235 
1237 
1240 
1243 
1252  // force an orientation reset AFTER the next time the observer position is updated
1253  // Needed when making large attach jumps
1255 
1257 
1259  osg::Vec3d myViewIntersect;
1260 
1262  osg::Vec3d myDownIntersect;
1263 
1264  osg::Vec3d myAttachPosition;
1265 
1268 
1272 
1273  double myAltitude;
1274 
1279 
1283 
1284  typedef boost::unordered_map<DtElementID, bool> ElementVisibilityMap;
1286 
1287  // Paged terrain initialization
1294 
1295  // Used for speed scaling, this is the same as myHeightAboveTerrain
1296  // when unattached, but the distance from the attached entity when
1297  // attached
1299 
1300  // curvature adjustment
1303  };
1304 
1305 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)