X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2Fgroundcache.cxx;h=9d83e283e2c1474a27d7c68e138b63d7ce8cf636;hb=38226af24ec01e8f0a20d7fd73ef838a69f6ef25;hp=e2414806c96da068a08caa6f6d0075d34c7c21d9;hpb=70be1629e61d9b751a2f73df30b83bb1be6ca4fe;p=flightgear.git diff --git a/src/FDM/groundcache.cxx b/src/FDM/groundcache.cxx index e2414806c..9d83e283e 100644 --- a/src/FDM/groundcache.cxx +++ b/src/FDM/groundcache.cxx @@ -151,8 +151,8 @@ public: const SGMaterial* material = _material; _haveHit = false; - _center = SGVec3d(inverseMatrix.preMult(_center.osg())); - _down = SGVec3d(osg::Matrix::transform3x3(_down.osg(), inverseMatrix)); + _center = toSG(inverseMatrix.preMult(toOsg(_center))); + _down = toSG(osg::Matrix::transform3x3(toOsg(_down), inverseMatrix)); if (velocity) { SGVec3d staticCenter(_center); @@ -208,7 +208,7 @@ public: _sceneryHit = ori.transform(_sceneryHit); _sceneryHit += dt*velocity->linear; } - _sceneryHit = SGVec3d(matrix.preMult(_sceneryHit.osg())); + _sceneryHit = toSG(matrix.preMult(toOsg(_sceneryHit))); } else { _material = material; _haveHit = haveHit; @@ -263,7 +263,8 @@ public: SGLineSegmentd downSeg(_center, _center + _maxDown*_down); double maxDist = bound._radius + _radius; - return distSqr(downSeg, SGVec3d(bound._center)) <= maxDist*maxDist; + SGVec3d boundCenter(toVec3d(toSG(bound._center))); + return distSqr(downSeg, boundCenter) <= maxDist*maxDist; } SGSharedPtr getBVHNode() const @@ -327,7 +328,7 @@ FGGroundCache::prepare_ground_cache(double startSimTime, double endSimTime, SGGeod geodPt = SGGeod::fromCart(pt); // Don't blow away the cache ground_radius and stuff if there's no // scenery - if (!globals->get_tile_mgr()->scenery_available(geodPt, rad)) { + if (!globals->get_tile_mgr()->schedule_scenery(geodPt, rad, 1.0)) { SG_LOG(SG_FLIGHT, SG_WARN, "prepare_ground_cache(): scenery_available " "returns false at " << geodPt << " " << pt << " " << rad); return false; @@ -474,11 +475,10 @@ public: if (_id == transform.getId()) { _foundId = true; - return; + } else { + transform.traverse(*this); } - transform.traverse(*this); - if (_foundId) { SGMatrixd toWorld = transform.getToWorldTransform(_time); SGVec3d referencePoint = _bodyToWorld.xformPt(SGVec3d::zeros()); @@ -541,9 +541,9 @@ FGGroundCache::get_body(double t, SGMatrixd& bodyToWorld, SGVec3d& linearVel, class FGGroundCache::CatapultFinder : public BVHVisitor { public: CatapultFinder(const SGSphered& sphere, const double& t) : + _haveLineSegment(false), _sphere(sphere), - _time(t), - _haveLineSegment(false) + _time(t) { } virtual void apply(BVHGroup& leaf)