]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/bvh/BVHMotionTransform.cxx
Remove using std:: from the metar header, remove HTTP support, add very basic unit...
[simgear.git] / simgear / scene / bvh / BVHMotionTransform.cxx
index d97b66f10cc06abea41e5dbe62893b094db644f6..249c07841fb8027179e04341bb10eb849c614390 100644 (file)
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+
 #include "BVHMotionTransform.hxx"
 
 #include "BVHVisitor.hxx"
@@ -31,7 +35,9 @@ BVHMotionTransform::BVHMotionTransform() :
     _linearVelocity(0, 0, 0),
     _angularVelocity(0, 0, 0),
     _referenceTime(0),
-    _endTime(0)
+    _startTime(0),
+    _endTime(0),
+    _id(0)
 {
 }
 
@@ -55,7 +61,9 @@ BVHMotionTransform::setTransform(const BVHMotionTransform& transform)
     _linearVelocity = transform._linearVelocity;
     _angularVelocity = transform._angularVelocity;
     _referenceTime = transform._referenceTime;
+    _startTime = transform._startTime;
     _endTime = transform._endTime;
+    _id = transform._id;
     invalidateParentBound();
 }
 
@@ -83,7 +91,8 @@ BVHMotionTransform::computeBoundingSphere() const
     SGSphered sphere(BVHGroup::computeBoundingSphere());
     if (sphere.empty())
         return sphere;
-    SGVec3d centerStart = _toWorldReference.xformPt(sphere.getCenter());
+    SGMatrixd toWorldStart = getToWorldTransform(_startTime);
+    SGVec3d centerStart = toWorldStart.xformPt(sphere.getCenter());
     SGMatrixd toWorldEnd = getToWorldTransform(_endTime);
     SGVec3d centerEnd = toWorldEnd.xformPt(sphere.getCenter());
     double rad = 0.5*length(centerStart - centerEnd) + sphere.getRadius();
@@ -98,13 +107,13 @@ BVHMotionTransform::updateAmplificationFactors()
     // But anyway, almost all transforms in a scenegraph will
     // have them equal to 1 ...
     double r = norm(_toWorldReference.xformVec(SGVec3d(1, 0, 0)));
-    r = std::max(r, norm(_toWorldReference.xformVec(SGVec3d(0, 1, 0))));
-    r = std::max(r, norm(_toWorldReference.xformVec(SGVec3d(0, 0, 1))));
+       r = SGMiscd::max(r, norm(_toWorldReference.xformVec(SGVec3d(0, 1, 0))));
+    r = SGMiscd::max(r, norm(_toWorldReference.xformVec(SGVec3d(0, 0, 1))));
     _toWorldAmplification = r;
     
     r = norm(_toLocalReference.xformVec(SGVec3d(1, 0, 0)));
-    r = std::max(r, norm(_toLocalReference.xformVec(SGVec3d(0, 1, 0))));
-    r = std::max(r, norm(_toLocalReference.xformVec(SGVec3d(0, 0, 1))));
+    r = SGMiscd::max(r, norm(_toLocalReference.xformVec(SGVec3d(0, 1, 0))));
+    r = SGMiscd::max(r, norm(_toLocalReference.xformVec(SGVec3d(0, 0, 1))));
     _toLocalAmplification = r;
 }