![]() |
VR-Vantage 1.4.1 API Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2009 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtUpdater.h,v $ $Revision: 1.19 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #pragma once 00014 #include <vrvCore/vrvCore.h> 00015 #include <vrvCore/DtUniqueID.h> 00016 #include <vrvCore/DtSceneObject.h> 00017 00018 #include <boost/signals.hpp> 00019 00020 namespace makVrv 00021 { 00022 class DtDe; 00023 class DtDeSharedState; 00024 00029 class DT_DLL_VRVCORE DtUpdater 00030 { 00031 public: 00032 friend class DtUpdaterManager; 00033 00035 DtUpdater( DtDe& de, DtUniqueID id, bool doNotAddToMgr = false ); 00036 00038 virtual ~DtUpdater(); 00039 00041 inline void updateIfNecessary(double simTime) 00042 { 00043 if(lastUpdateTime() < simTime ) 00044 { 00045 update( simTime ); 00046 } 00047 } 00048 00051 virtual void update( double simTime ) = 0; 00052 00054 virtual void setSceneObject( DtSceneObject* sceneObject); 00055 00057 DtSceneObject* findSceneObject(); 00058 00060 inline double lastUpdateTime() const 00061 { 00062 return myLastUpdateTime; 00063 } 00064 00066 inline DtUniqueID uniqueId() const 00067 { 00068 return myUniqueId; 00069 } 00070 00072 virtual void setUpdaterPosition( int vtx, const DtVector& position ); 00073 00075 virtual const DtVector& updaterPosition( int vtx ) const; 00076 00078 virtual void setUpdaterOrientation( int vtx, const DtTaitBryan& orientation ); 00079 00081 virtual const DtTaitBryan& updaterOrientation( int vtx ) const; 00082 00084 void updateSceneObject(); 00085 00087 bool inManager() const; 00088 00089 // Checks terrain scaling flag, then scales myTransforms if scaling is on 00090 virtual void terrainScaleTransformsIfNeeded(); 00091 00092 boost::signal< void (const DtUniqueID&) > signal_updaterToBeDeleted; 00093 00094 protected: 00095 00096 DtDe& myDe; 00097 DtUniqueID myUniqueId; 00098 00099 // pointer to the scene object being updated 00100 DtSceneObject* mySceneObject; 00101 double myLastUpdateTime; 00102 00103 // local copy of the vertex positions and orientations. These are typically 00104 // calculated in one step, and then pushed to the scene object in a second, 00105 // making the concatenation of updaters simpler. 00106 DtSceneObject::TransformList myTransforms; 00107 bool myInManager; 00108 00109 // This is kept to make terrain scale updating cheaper (by one virtual 00110 // function call) 00111 const DtDeSharedState& myDeSharedState; 00112 }; 00113 }