From 9eb5cf6c9815d5fdb645abd04ec1d47e597701d3 Mon Sep 17 00:00:00 2001
From: frohlich <frohlich>
Date: Sat, 14 Mar 2009 12:26:30 +0000
Subject: [PATCH] Add a reference time to the velocity stuff.

Modified Files:
	simgear/scene/model/ModelRegistry.cxx
	simgear/scene/model/placement.cxx
	simgear/scene/model/placement.hxx
	simgear/scene/util/SGSceneUserData.hxx
---
 simgear/scene/model/placement.cxx      | 9 +++++++++
 simgear/scene/model/placement.hxx      | 1 +
 simgear/scene/util/SGSceneUserData.hxx | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/simgear/scene/model/placement.cxx b/simgear/scene/model/placement.cxx
index f781ab3e..f46243d3 100644
--- a/simgear/scene/model/placement.cxx
+++ b/simgear/scene/model/placement.cxx
@@ -135,6 +135,15 @@ SGModelPlacement::setOrientation (const SGQuatd& orientation)
   orientation.getEulerDeg(_heading_deg, _pitch_deg, _roll_deg);
 }
 
+void
+SGModelPlacement::setReferenceTime(const double& referenceTime)
+{
+  SGSceneUserData* userData;
+  userData = SGSceneUserData::getOrCreateSceneUserData(_transform);
+  SGSceneUserData::Velocity* vel = userData->getOrCreateVelocity();
+  vel->referenceTime = referenceTime;
+}
+
 void
 SGModelPlacement::setBodyLinearVelocity(const SGVec3d& linear)
 {
diff --git a/simgear/scene/model/placement.hxx b/simgear/scene/model/placement.hxx
index 34395223..9a723660 100644
--- a/simgear/scene/model/placement.hxx
+++ b/simgear/scene/model/placement.hxx
@@ -73,6 +73,7 @@ public:
                                double heading_deg);
   void setOrientation(const SGQuatd& orientation);
 
+  void setReferenceTime(const double& referenceTime);
   void setBodyLinearVelocity(const SGVec3d& velocity);
   void setBodyAngularVelocity(const SGVec3d& velocity);
   
diff --git a/simgear/scene/util/SGSceneUserData.hxx b/simgear/scene/util/SGSceneUserData.hxx
index e47703b9..4f3f38fc 100644
--- a/simgear/scene/util/SGSceneUserData.hxx
+++ b/simgear/scene/util/SGSceneUserData.hxx
@@ -51,10 +51,12 @@ public:
     Velocity() :
         linear(SGVec3d::zeros()),
         angular(SGVec3d::zeros()),
+        referenceTime(0),
         id(simgear::BVHNode::getNewId())
     {}
     SGVec3d linear;
     SGVec3d angular;
+    double referenceTime;
     simgear::BVHNode::Id id;
   };
   const Velocity* getVelocity() const
-- 
2.39.5