]> git.mxchange.org Git - flightgear.git/commitdiff
Use the new vector conversion functions.
authorfrohlich <frohlich>
Mon, 7 Sep 2009 21:40:46 +0000 (21:40 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 9 Sep 2009 06:56:31 +0000 (08:56 +0200)
Modified Files:
src/FDM/groundcache.cxx src/Main/renderer.cxx
src/Main/viewer.cxx src/Scenery/scenery.cxx

src/FDM/groundcache.cxx
src/Main/renderer.cxx
src/Main/viewer.cxx
src/Scenery/scenery.cxx

index ad56fc90f94ad9c8f7a6a0ad35c8efa2a32ed71e..69cd3f187bce5601ce6c7445d29783cbb759123f 100644 (file)
@@ -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<simgear::BVHNode> getBVHNode() const
index b222ca0fd7d7d5f3af5ddd12b4523912acd3a64a..7bde729aa58e2431f9cdf32b3bfdf7bd93abbf4a 100644 (file)
@@ -238,13 +238,13 @@ public:
     osg::Light* light = lightSource->getLight();
     
     FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
-    light->setAmbient(l->scene_ambient().osg());
-    light->setDiffuse(l->scene_diffuse().osg());
-    light->setSpecular(l->scene_specular().osg());
-    SGVec4f position(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2], 0);
-    light->setPosition(position.osg());
-    SGVec3f direction(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2]);
-    light->setDirection(direction.osg());
+    light->setAmbient(toOsg(l->scene_ambient()));
+    light->setDiffuse(toOsg(l->scene_diffuse()));
+    light->setSpecular(toOsg(l->scene_specular()));
+    osg::Vec4f position(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2], 0);
+    light->setPosition(position);
+    osg::Vec3f direction(l->sun_vec()[0], l->sun_vec()[1], l->sun_vec()[2]);
+    light->setDirection(direction);
     light->setSpotExponent(0);
     light->setSpotCutoff(180);
     light->setConstantAttenuation(1);
@@ -292,7 +292,7 @@ public:
 
 #if 0
     FGLight *l = static_cast<FGLight*>(globals->get_subsystem("lighting"));
-    lightModel->setAmbientIntensity(l->scene_ambient().osg());
+    lightModel->setAmbientIntensity(toOsg(l->scene_ambient());
 #else
     lightModel->setAmbientIntensity(osg::Vec4(0, 0, 0, 1));
 #endif
@@ -335,7 +335,7 @@ public:
     SGUpdateVisitor* updateVisitor = static_cast<SGUpdateVisitor*>(nv);
     osg::Fog* fog = static_cast<osg::Fog*>(sa);
     fog->setMode(osg::Fog::EXP2);
-    fog->setColor(updateVisitor->getFogColor().osg());
+    fog->setColor(toOsg(updateVisitor->getFogColor()));
     fog->setDensity(updateVisitor->getFogExp2Density());
   }
 };
@@ -571,11 +571,11 @@ FGRenderer::update( bool refresh_camera_settings ) {
        
         if ( fgGetBool("/sim/rendering/textures") ) {
             SGVec4f clearColor(l->adj_fog_color());
-            camera->setClearColor(clearColor.osg());
+            camera->setClearColor(toOsg(clearColor));
         }
     } else {
         SGVec4f clearColor(l->sky_color());
-        camera->setClearColor(clearColor.osg());
+        camera->setClearColor(toOsg(clearColor));
     }
 
     // update fog params if visibility has changed
@@ -785,8 +785,8 @@ FGRenderer::pick(std::vector<SGSceneryPick>& pickList,
                 if (!pickCallback)
                     continue;
                 SGSceneryPick sceneryPick;
-                sceneryPick.info.local = SGVec3d(hit->getLocalIntersectPoint());
-                sceneryPick.info.wgs84 = SGVec3d(hit->getWorldIntersectPoint());
+                sceneryPick.info.local = toSG(hit->getLocalIntersectPoint());
+                sceneryPick.info.wgs84 = toSG(hit->getWorldIntersectPoint());
                 sceneryPick.callback = pickCallback;
                 pickList.push_back(sceneryPick);
             }
index 118776da3e03a3f55b67b201ac0bd7fa3a7890d5..2e34db687f6b62f2261c8ca57c58a56ccc6e6198 100644 (file)
@@ -659,6 +659,6 @@ FGViewer::update (double dt)
     }
   }
   recalc();
-  _cameraGroup->update(_absolute_view_pos.osg(), mViewOrientation.osg());
+  _cameraGroup->update(toOsg(_absolute_view_pos), toOsg(mViewOrientation));
   _cameraGroup->setCameraParameters(get_v_fov(), get_aspect_ratio());
 }
index 5ca6ddd87f30d6bc53504de9cc48ddbb7e420aa6..73c53733aa7f07ea1a36707e164104059d660115 100644 (file)
@@ -143,7 +143,7 @@ FGScenery::get_elevation_m(const SGGeod& geod, double& alt,
   osgUtil::IntersectVisitor intersectVisitor;
   intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
   osg::ref_ptr<osg::LineSegment> lineSegment;
-  lineSegment = new osg::LineSegment(start.osg(), end.osg());
+  lineSegment = new osg::LineSegment(toOsg(start), toOsg(end));
   intersectVisitor.addLineSegment(lineSegment.get());
   get_scene_graph()->accept(intersectVisitor);
   bool hits = false;
@@ -195,7 +195,7 @@ FGScenery::get_cart_ground_intersection(const SGVec3d& pos, const SGVec3d& dir,
   osgUtil::IntersectVisitor intersectVisitor;
   intersectVisitor.setTraversalMask(SG_NODEMASK_TERRAIN_BIT);
   osg::ref_ptr<osg::LineSegment> lineSegment;
-  lineSegment = new osg::LineSegment(start.osg(), end.osg());
+  lineSegment = new osg::LineSegment(toOsg(start), toOsg(end));
   intersectVisitor.addLineSegment(lineSegment.get());
   get_scene_graph()->accept(intersectVisitor);
   bool hits = false;
@@ -235,7 +235,7 @@ bool FGScenery::scenery_available(const SGGeod& position, double range_m)
     if (!get_elevation_m(SGGeod::fromGeodM(position, SG_MAX_ELEVATION_M), elev, 0, 0))
       return false;
     SGVec3f p = SGVec3f::fromGeod(SGGeod::fromGeodM(position, elev));
-    simgear::CheckSceneryVisitor csnv(getPagerSingleton(), p.osg(), range_m);
+    simgear::CheckSceneryVisitor csnv(getPagerSingleton(), toOsg(p), range_m);
     // currently the PagedLODs will not be loaded by the DatabasePager
     // while the splashscreen is there, so CheckSceneryVisitor force-loads
     // missing objects in the main thread