]> git.mxchange.org Git - simgear.git/commitdiff
Switch to new vector conversion functions.
authorfrohlich <frohlich>
Mon, 7 Sep 2009 21:42:50 +0000 (21:42 +0000)
committerTim Moore <timoore@redhat.com>
Wed, 9 Sep 2009 06:39:55 +0000 (08:39 +0200)
Modified Files:
simgear/math/SGGeod.cxx simgear/math/SGQuat.hxx
simgear/math/SGVec2.hxx simgear/math/SGVec3.hxx
simgear/math/SGVec4.hxx simgear/scene/material/Effect.cxx
simgear/scene/model/SGInteractionAnimation.cxx
simgear/scene/model/SGMaterialAnimation.cxx
simgear/scene/model/SGRotateTransform.cxx
simgear/scene/model/SGScaleTransform.cxx
simgear/scene/model/SGTranslateTransform.cxx
simgear/scene/model/animation.cxx
simgear/scene/model/particles.cxx
simgear/scene/model/placement.cxx
simgear/scene/model/shadanim.cxx
simgear/scene/sky/CloudShaderGeometry.cxx
simgear/scene/sky/cloud.cxx simgear/scene/sky/cloudfield.cxx
simgear/scene/sky/dome.cxx simgear/scene/sky/sky.cxx
simgear/scene/tgdb/GroundLightManager.cxx
simgear/scene/tgdb/SGOceanTile.cxx
simgear/scene/tgdb/SGTexturedTriangleBin.hxx
simgear/scene/tgdb/SGVasiDrawable.cxx
simgear/scene/tgdb/TreeBin.cxx simgear/scene/tgdb/obj.cxx
  simgear/scene/tgdb/pt_lights.cxx
simgear/scene/util/SGUpdateVisitor.hxx

28 files changed:
simgear/math/SGGeod.cxx
simgear/math/SGQuat.hxx
simgear/math/SGVec2.hxx
simgear/math/SGVec3.hxx
simgear/math/SGVec4.hxx
simgear/scene/material/Effect.cxx
simgear/scene/model/SGInteractionAnimation.cxx
simgear/scene/model/SGMaterialAnimation.cxx
simgear/scene/model/SGRotateTransform.cxx
simgear/scene/model/SGScaleTransform.cxx
simgear/scene/model/SGTranslateTransform.cxx
simgear/scene/model/animation.cxx
simgear/scene/model/particles.cxx
simgear/scene/model/placement.cxx
simgear/scene/model/shadanim.cxx
simgear/scene/sky/CloudShaderGeometry.cxx
simgear/scene/sky/cloud.cxx
simgear/scene/sky/cloudfield.cxx
simgear/scene/sky/dome.cxx
simgear/scene/sky/sky.cxx
simgear/scene/tgdb/GroundLightManager.cxx
simgear/scene/tgdb/SGOceanTile.cxx
simgear/scene/tgdb/SGTexturedTriangleBin.hxx
simgear/scene/tgdb/SGVasiDrawable.cxx
simgear/scene/tgdb/TreeBin.cxx
simgear/scene/tgdb/obj.cxx
simgear/scene/tgdb/pt_lights.cxx
simgear/scene/util/SGUpdateVisitor.hxx

index 370b9725f28db66143953ca923a43f10e0ab9dca..15468707dc4034ef7ad9ca959511aaf4438e7ba9 100644 (file)
@@ -22,7 +22,7 @@
 osg::Matrix SGGeod::makeSimulationFrameRelative() const
 {
     SGQuatd hlOr = SGQuatd::fromLonLat(*this);
-    return osg::Matrix(hlOr.osg());
+    return osg::Matrix(toOsg(hlOr));
 }
 
 osg::Matrix SGGeod::makeSimulationFrame() const
@@ -30,7 +30,7 @@ osg::Matrix SGGeod::makeSimulationFrame() const
     osg::Matrix result(makeSimulationFrameRelative());
     SGVec3d coord;
     SGGeodesy::SGGeodToCart(*this, coord);
-    result.setTrans(coord.osg());
+    result.setTrans(toOsg(coord));
     return result;
 }
 
@@ -48,7 +48,7 @@ osg::Matrix SGGeod::makeZUpFrame() const
     osg::Matrix result(makeZUpFrameRelative());
     SGVec3d coord;
     SGGeodesy::SGGeodToCart(*this, coord);
-    result.setTrans(coord.osg());
+    result.setTrans(toOsg(coord));
     return result;
 }
 
index b466d8966bc4e36fca5683516782352a6dec85fb..a48cbf1ab08a17c2deb8a0c35316c271248c2c00 100644 (file)
@@ -55,10 +55,6 @@ public:
   /// make sure it has at least 4 elements
   explicit SGQuat(const T* d)
   { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; data()[3] = d[3]; }
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-  explicit SGQuat(const osg::Quat& d)
-  { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; data()[3] = d[3]; }
-#endif
 
   /// Return a unit quaternion
   static SGQuat unit(void)
@@ -376,11 +372,6 @@ public:
   T (&data(void))[4]
   { return _data; }
 
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-  osg::Quat osg() const
-  { return osg::Quat(data()[0], data()[1], data()[2], data()[3]); }
-#endif
-
   /// Inplace addition
   SGQuat& operator+=(const SGQuat& v)
   { data()[0]+=v(0);data()[1]+=v(1);data()[2]+=v(2);data()[3]+=v(3);return *this; }
index 1e683b49aceb7674ca32b00856b65cc4df1c88f5..5024e2c19e56c00fe8d99fec47a160359886d14b 100644 (file)
@@ -55,12 +55,6 @@ public:
   template<typename S>
   explicit SGVec2(const SGVec2<S>& d)
   { data()[0] = d[0]; data()[1] = d[1]; }
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-  explicit SGVec2(const osg::Vec2f& d)
-  { data()[0] = d[0]; data()[1] = d[1]; }
-  explicit SGVec2(const osg::Vec2d& d)
-  { data()[0] = d[0]; data()[1] = d[1]; }
-#endif
 
   /// Access by index, the index is unchecked
   const T& operator()(unsigned i) const
@@ -96,11 +90,6 @@ public:
   T (&data(void))[2]
   { return _data; }
 
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-  osg::Vec2d osg() const
-  { return osg::Vec2d(data()[0], data()[1]); }
-#endif
-
   /// Inplace addition
   SGVec2& operator+=(const SGVec2& v)
   { data()[0] += v(0); data()[1] += v(1); return *this; }
index f2b7406a647083cdc5d4422d81b08cde6ba51312..cbdf0fa2c24d355dfdcded0da93b9d17a758e527 100644 (file)
@@ -53,12 +53,6 @@ public:
   { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; }
   explicit SGVec3(const SGVec2<T>& v2, const T& v3 = 0)
   { data()[0] = v2[0]; data()[1] = v2[1]; data()[2] = v3; }
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-  explicit SGVec3(const osg::Vec3f& d)
-  { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; }
-  explicit SGVec3(const osg::Vec3d& d)
-  { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; }
-#endif
 
   /// Access by index, the index is unchecked
   const T& operator()(unsigned i) const
@@ -100,11 +94,6 @@ public:
   T (&data(void))[3]
   { return _data; }
 
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-  osg::Vec3d osg() const
-  { return osg::Vec3d(data()[0], data()[1], data()[2]); }
-#endif
-
   /// Inplace addition
   SGVec3& operator+=(const SGVec3& v)
   { data()[0] += v(0); data()[1] += v(1); data()[2] += v(2); return *this; }
index 335393fbeb6f94591d94e435eb4d61334030579e..baf9137daa2aba31e290c5c81a022f72d2254847 100644 (file)
@@ -53,12 +53,6 @@ public:
   { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; data()[3] = d[3]; }
   explicit SGVec4(const SGVec3<T>& v3, const T& v4 = 0)
   { data()[0] = v3[0]; data()[1] = v3[1]; data()[2] = v3[2]; data()[3] = v4; }
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-  explicit SGVec4(const osg::Vec4f& d)
-  { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; data()[3] = d[3]; }
-  explicit SGVec4(const osg::Vec4d& d)
-  { data()[0] = d[0]; data()[1] = d[1]; data()[2] = d[2]; data()[3] = d[3]; }
-#endif
 
   /// Access by index, the index is unchecked
   const T& operator()(unsigned i) const
@@ -106,11 +100,6 @@ public:
   T (&data(void))[4]
   { return _data; }
 
-#ifndef NO_OPENSCENEGRAPH_INTERFACE
-  osg::Vec4d osg() const
-  { return osg::Vec4d(data()[0], data()[1], data()[2], data()[3]); }
-#endif
-
   /// Inplace addition
   SGVec4& operator+=(const SGVec4& v)
   { data()[0]+=v(0);data()[1]+=v(1);data()[2]+=v(2);data()[3]+=v(3);return *this; }
index f812f57a402d2664f17279710c400dc01ab58288..b36702adaaebdc95e0d299d5c720bd2c25c5f19b 100644 (file)
@@ -168,9 +168,9 @@ osg::Vec4f getColor(const SGPropertyNode* prop)
 {
     if (prop->nChildren() == 0) {
         if (prop->getType() == props::VEC4D) {
-            return osg::Vec4f(prop->getValue<SGVec4d>().osg());
+            return osg::Vec4f(toOsg(prop->getValue<SGVec4d>()));
         } else if (prop->getType() == props::VEC3D) {
-            return osg::Vec4f(prop->getValue<SGVec3d>().osg(), 1.0f);
+            return osg::Vec4f(toOsg(prop->getValue<SGVec3d>()), 1.0f);
         } else {
             SG_LOG(SG_INPUT, SG_ALERT,
                    "invalid color property " << prop->getName() << " "
@@ -417,7 +417,7 @@ TexEnv* buildTexEnv(Effect* effect, const SGPropertyNode* prop)
     }
     TexEnv* env = new TexEnv(mode);
     if (colorProp)
-        env->setColor(colorProp->getValue<SGVec4d>().osg());
+        env->setColor(toOsg(colorProp->getValue<SGVec4d>()));
     return env;
  }
 
@@ -623,10 +623,10 @@ struct UniformBuilder :public PassAttributeBuilder
             uniform->set(valProp->getValue<float>());
             break;
         case Uniform::FLOAT_VEC3:
-            uniform->set(Vec3f(valProp->getValue<SGVec3d>().osg()));
+            uniform->set(toOsg(valProp->getValue<SGVec3d>()));
             break;
         case Uniform::FLOAT_VEC4:
-            uniform->set(Vec4f(valProp->getValue<SGVec4d>().osg()));
+            uniform->set(toOsg(valProp->getValue<SGVec4d>()));
             break;
         case Uniform::SAMPLER_1D:
         case Uniform::SAMPLER_2D:
index 956d7b69f693ddb1a6f8cd37e5391acdc1ba1fea..9e7987e9147048fed39849013c1485a40a982663 100644 (file)
@@ -80,8 +80,8 @@ public:
         // Trick to get the ends in the right order.
         // Use the x axis in the original coordinate system. Choose the
         // most negative x-axis as the one pointing forward
-        SGVec3f tv1(_matrix.preMult(v1));
-        SGVec3f tv2(_matrix.preMult(v2));
+        SGVec3f tv1(toSG(_matrix.preMult(v1)));
+        SGVec3f tv2(toSG(_matrix.preMult(v2)));
         if (tv1[0] > tv2[0])
             _lineSegments.push_back(SGLineSegmentf(tv1, tv2));
         else
index 1e7afdd976dbdf219312d49d651ac283718ca3c2..ca9ac364d27c42e36a5bcd00cf4590a406ecd23c 100644 (file)
@@ -100,7 +100,7 @@ struct ColorSpec {
 
   osg::Vec4 rgbaVec4()
   {
-    return rgba().osg();
+    return toOsg(rgba());
   }
   
   SGVec4f &initialRgba() {
index 0b79f59ec051329bd827c29a78f6b66ee944eeb4..d547483958e10477c7cef88bc329017f12c66ec7 100644 (file)
@@ -128,7 +128,7 @@ osg::BoundingSphere
 SGRotateTransform::computeBound() const
 {
   osg::BoundingSphere bs = osg::Group::computeBound();
-  osg::BoundingSphere centerbs(_center.osg(), bs.radius());
+  osg::BoundingSphere centerbs(toOsg(_center), bs.radius());
   centerbs.expandBy(bs);
   return centerbs;
 }
@@ -147,7 +147,7 @@ bool RotateTransform_readLocalData(osg::Object& obj, osgDB::Input& fr)
             fr += 3;
         else
             return false;
-        rot.setCenter(SGVec3d(center));
+        rot.setCenter(toSG(center));
     }
     if (fr[0].matchWord("axis")) {
         ++fr;
@@ -156,7 +156,7 @@ bool RotateTransform_readLocalData(osg::Object& obj, osgDB::Input& fr)
             fr += 3;
         else
             return false;
-        rot.setCenter(SGVec3d(axis));
+        rot.setCenter(toSG(axis));
     }
     if (fr[0].matchWord("angle")) {
         ++fr;
index 4907cbd97e764bbbdf5aef16041b8bbc459bf64a..ab9d6215742674e8a9dfde02438927d36bd5b620 100644 (file)
@@ -112,7 +112,7 @@ bool ScaleTransform_readLocalData(osg::Object& obj, osgDB::Input& fr)
             fr += 3;
         else
             return false;
-        scale.setCenter(SGVec3d(center));
+        scale.setCenter(toSG(center));
     }
     if (fr[0].matchWord("scaleFactor")) {
         ++fr;
@@ -121,7 +121,7 @@ bool ScaleTransform_readLocalData(osg::Object& obj, osgDB::Input& fr)
             fr += 3;
         else
             return false;
-        scale.setScaleFactor(SGVec3d(scaleFactor));
+        scale.setScaleFactor(toSG(scaleFactor));
     }
     return true;
 }
index 8fc30d907ff7d3e4d6d81d2ba79f6766caad46b3..182c30bfbf3b95da6ab546b4fdd24107ac481a08 100644 (file)
@@ -49,9 +49,9 @@ SGTranslateTransform::computeLocalToWorldMatrix(osg::Matrix& matrix,
                                                 osg::NodeVisitor* nv) const 
 {
   if (_referenceFrame == RELATIVE_RF) {
-    matrix.preMultTranslate((_value*_axis).osg());
+    matrix.preMultTranslate(toOsg(_value*_axis));
   } else {
-    matrix.setTrans((_value*_axis).osg());
+    matrix.setTrans(toOsg(_value*_axis));
   }
   return true;
 }
@@ -61,9 +61,9 @@ SGTranslateTransform::computeWorldToLocalMatrix(osg::Matrix& matrix,
                                                 osg::NodeVisitor* nv) const
 {
   if (_referenceFrame == RELATIVE_RF) {
-    matrix.postMultTranslate((-_value*_axis).osg());
+    matrix.postMultTranslate(toOsg(-_value*_axis));
   } else {
-    matrix.setTrans((-_value*_axis).osg());
+    matrix.setTrans(toOsg(-_value*_axis));
   }
   return true;
 }
@@ -72,7 +72,7 @@ osg::BoundingSphere
 SGTranslateTransform::computeBound() const
 {
   osg::BoundingSphere bs = osg::Group::computeBound();
-  bs._center += _axis.osg()*_value;
+  bs._center += toOsg(_axis)*_value;
   return bs;
 }
 
@@ -89,7 +89,7 @@ bool TranslateTransform_readLocalData(osg::Object& obj, osgDB::Input& fr)
             fr += 3;
         else
             return false;
-        trans.setAxis(SGVec3d(axis));
+        trans.setAxis(toSG(axis));
     }
     if (fr[0].matchWord("value")) {
         ++fr;
index e62c2675ccaaffe1bae02a68ec702d1adebbba55..a52174d387d84d897252d0ed9ae9df5070e96cef 100644 (file)
@@ -1024,7 +1024,7 @@ private:
     if (!nv)
       return 1;
 
-    double scale_factor = (_center.osg() - nv->getEyePoint()).length();
+    double scale_factor = (toOsg(_center) - nv->getEyePoint()).length();
     if (_table == 0) {
       scale_factor = _factor * scale_factor + _offset;
     } else {
index 9f3aeb7d686414cbc4b57b67904e4cc7f205389e..b5687ed41e2f04465620da3927d67af118cf7af6 100644 (file)
@@ -59,7 +59,7 @@ void GlobalParticleCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
     SGQuatd q
         = SGQuatd::fromLonLatDeg(modelRoot->getFloatValue("/position/longitude-deg",0),
                                  modelRoot->getFloatValue("/position/latitude-deg",0));
-    osg::Matrix om(q.osg());
+    osg::Matrix om(toOsg(q));
     osg::Vec3 v(0,0,9.81);
     gravity = om.preMult(v);
     const osg::Vec3& zUpWind = Particles::getWindVector();
@@ -552,7 +552,7 @@ void Particles::operator()(osg::Node* node, osg::NodeVisitor* nv)
             if (displace * displace > 10000.0 * 10000.0) {
                 // Make new frame for particle system, coincident with
                 // the emitter frame, but oriented with local Z.
-                SGGeod geod = SGGeod::fromCart(SGVec3d(emitOrigin));
+                SGGeod geod = SGGeod::fromCart(toSG(emitOrigin));
                 Matrix newParticleMat = geod.makeZUpFrame();
                 Matrix changeParticleFrame
                     = particleMat * Matrix::inverse(newParticleMat);
index 486113d8287eba2fcd4becbcb47b513a9753575a..cd38181e212c611cee2ab8fb53a9921f0f697ca2 100644 (file)
@@ -46,7 +46,7 @@ SGModelPlacement::update()
 {
   // The cartesian position
   SGVec3d position = SGVec3d::fromGeod(_position);
-  _transform->setPosition(position.osg());
+  _transform->setPosition(toOsg(position));
 
   // The orientation, composed from the horizontal local orientation and the
   // orientation wrt the horizontal local frame
@@ -56,7 +56,7 @@ SGModelPlacement::update()
   // the y axis 180 degrees.
   orient *= SGQuatd::fromRealImag(0, SGVec3d(0, 1, 0));
 
-  _transform->setAttitude(orient.osg());
+  _transform->setAttitude(toOsg(orient));
 }
 
 bool
index 6c0ad494101bd4d6075f2540d4c46c87cd16830b..cb9270a30cdbf5df1513c9ded3a3cfce0ea16c99 100644 (file)
@@ -107,8 +107,8 @@ public:
     // FIXME: need an update or callback ...
     // generate the six highlight map images (light direction = [1, 1, -1])
     osg::ref_ptr<osgUtil::HighlightMapGenerator> mapgen;
-    mapgen = new osgUtil::HighlightMapGenerator(_lastLightDirection.osg(),
-                                                _lastLightColor.osg(), 5);
+    mapgen = new osgUtil::HighlightMapGenerator(toOsg(_lastLightDirection),
+                                                toOsg(_lastLightColor), 5);
     mapgen->generateMap();
 
     // assign the six images to the texture object
@@ -209,8 +209,8 @@ public:
     if (!combine)
        return;
     // An approximation for light reflected back by chrome.
-    osg::Vec4 globalColor = (updateVisitor->getAmbientLight().osg() * .4f
-                            + updateVisitor->getDiffuseLight().osg());
+    osg::Vec4 globalColor = toOsg(updateVisitor->getAmbientLight() * .4f
+                                  + updateVisitor->getDiffuseLight());
     globalColor.a() = 1.0f;
     combine->setConstantColor(globalColor);
   }
index 53e1b3d43575368756d7f649e47ff2c2593cec55..49244faf4f3f42af3f71884222befb75c208b8d5 100755 (executable)
@@ -74,7 +74,7 @@ void CloudShaderGeometry::drawImplementation(RenderInfo& renderInfo) const
              itr != end;
              ++itr) {
             Vec4f projPos
-                = Vec4f(_cloudsprites[itr->idx].position.osg(), 1.0f) * mvp;
+                = Vec4f(toOsg(_cloudsprites[itr->idx].position), 1.0f) * mvp;
             itr->depth = projPos.z() / projPos.w();
         }
         // Already sorted?
index 503763149450c72f355ad525f4036e514055eed9..68e41deb2b3c98eab8113c8afa5d8915476da126 100644 (file)
@@ -605,7 +605,7 @@ SGCloudLayer::rebuild()
 
 // repaint the cloud layer colors
 bool SGCloudLayer::repaint( const SGVec3f& fog_color ) {
-    osg::Vec4f combineColor(fog_color.osg(), cloud_alpha);
+    osg::Vec4f combineColor(toOsg(fog_color), cloud_alpha);
     osg::TexEnvCombine* combiner
         = dynamic_cast<osg::TexEnvCombine*>(layer_root->getStateSet()
                                             ->getTextureAttribute(1, osg::StateAttribute::TEXENV));
@@ -625,7 +625,7 @@ bool SGCloudLayer::reposition( const SGVec3f& p, const SGVec3f& up, double lon,
                               double alt, double dt )
 {
     // combine p and asl (meters) to get translation offset
-    osg::Vec3 asl_offset(up.osg());
+    osg::Vec3 asl_offset(toOsg(up));
     asl_offset.normalize();
     if ( alt <= layer_asl ) {
         asl_offset *= layer_asl;
@@ -635,7 +635,7 @@ bool SGCloudLayer::reposition( const SGVec3f& p, const SGVec3f& up, double lon,
 
     // cout << "asl_offset = " << asl_offset[0] << "," << asl_offset[1]
     //      << "," << asl_offset[2] << endl;
-    asl_offset += p.osg();
+    asl_offset += toOsg(p);
     // cout << "  asl_offset = " << asl_offset[0] << "," << asl_offset[1]
     //      << "," << asl_offset[2] << endl;
 
index 7ecd4292995e6b0711990bf8d4f1a467b9a33462..770f4da05db1a70e2bf100537789763d736ce4da 100644 (file)
@@ -96,7 +96,7 @@ bool SGCloudField::reposition( const SGVec3f& p, const SGVec3f& up, double lon,
         // First time or very large distance
         SGVec3<double> cart;
         SGGeodesy::SGGeodToCart(SGGeod::fromRad(lon, lat), cart);
-        T.makeTranslate(cart.osg());
+        T.makeTranslate(toOsg(cart));
         
         LON.makeRotate(lon, osg::Vec3(0, 0, 1));
         LAT.makeRotate(90.0 * SGD_DEGREES_TO_RADIANS - lat, osg::Vec3(0, 1, 0));
@@ -129,7 +129,7 @@ bool SGCloudField::reposition( const SGVec3f& p, const SGVec3f& up, double lon,
         
         SGVec3<double> cart;
         SGGeodesy::SGGeodToCart(SGGeod::fromRad(cld_pos.getLongitudeRad(), cld_pos.getLatitudeRad()), cart);
-        T.makeTranslate(cart.osg());
+        T.makeTranslate(toOsg(cart));
         
         LON.makeRotate(cld_pos.getLongitudeRad(), osg::Vec3(0, 0, 1));
         LAT.makeRotate(90.0 * SGD_DEGREES_TO_RADIANS - cld_pos.getLatitudeRad(), osg::Vec3(0, 1, 0));
@@ -274,7 +274,7 @@ void SGCloudField::addCloud( SGVec3f& pos, SGNewCloud *cloud) {
         
         osg::ref_ptr<osg::PositionAttitudeTransform> transform = new osg::PositionAttitudeTransform;
 
-        transform->setPosition(pos.osg());
+        transform->setPosition(toOsg(pos));
         transform->addChild(geode.get());
         
         field_group[x][y]->addChild(transform.get(), true);
index 3bdb48ab7be9f28deb48086ef410e3a85a32f46c..cea4b6cffde9f1c55993758b03c7bb335bb2dd88 100644 (file)
@@ -258,7 +258,7 @@ SGSkyDome::repaint( const SGVec3f& sun_color, const SGVec3f& sky_color,
     const float upperVisFactor = 1.0 - vis_factor * (0.7 + 0.3 * cvf/45000);
     const float middleVisFactor = 1.0 - vis_factor * (0.1 + 0.85 * cvf/45000);
 
-    (*dome_cl)[0] = sky_color.osg();
+    (*dome_cl)[0] = toOsg(sky_color);
     simgear::VectorArrayAdapter<Vec3Array> colors(*dome_cl, numBands, 1);
     const double saif = sun_angle/SG_PI;
     static const SGVec3f blueShift(0.8, 1.0, 1.2);
@@ -271,9 +271,9 @@ SGSkyDome::repaint( const SGVec3f& sun_color, const SGVec3f& sky_color,
     for (int i = 0; i < halfBands+1; i++) {
         SGVec3f diff = mult(skyFogDelta, blueShift);
         diff *= (0.8 + saif - ((halfBands-i)/10));
-        colors(2, i) = (sky_color - upperVisFactor * diff).osg();
-        colors(3, i) = (sky_color - middleVisFactor * diff + middle_amt).osg();
-        colors(4, i) = (fog_color + outer_amt).osg();
+        colors(2, i) = toOsg(sky_color - upperVisFactor * diff);
+        colors(3, i) = toOsg(sky_color - middleVisFactor * diff + middle_amt);
+        colors(4, i) = toOsg(fog_color + outer_amt);
         colors(0, i) = simgear::math::lerp(toOsg(sky_color), colors(2, i), .3942);
         colors(1, i) = simgear::math::lerp(toOsg(sky_color), colors(2, i), .7885);
         for (int j = 0; j < numRings - 1; ++j)
@@ -292,7 +292,7 @@ SGSkyDome::repaint( const SGVec3f& sun_color, const SGVec3f& sky_color,
                       numBands);
 
     for ( int i = 0; i < numBands; i++ )
-        colors(numRings - 1, i) = fog_color.osg();
+        colors(numRings - 1, i) = toOsg(fog_color);
     dome_cl->dirty();
     return true;
 }
@@ -313,7 +313,7 @@ SGSkyDome::reposition( const SGVec3f& p, double _asl,
     // Translate to view position
     // Point3D zero_elev = current_view.get_cur_zero_elev();
     // xglTranslatef( zero_elev.x(), zero_elev.y(), zero_elev.z() );
-    T.makeTranslate( p.osg() );
+    T.makeTranslate( toOsg(p) );
 
     // printf("  Translated to %.2f %.2f %.2f\n", 
     //        zero_elev.x, zero_elev.y, zero_elev.z );
index 7714dd0a92d93b495d964dc833109e3cdf2e4d5c..5367550b9229d74f90b8b7899ae183f44ee597fe 100644 (file)
@@ -131,7 +131,7 @@ bool SGSky::repaint( const SGSkyColor &sc, const SGEphemeris& eph )
        disable();
     }
     SGCloudField::updateFog((double)effective_visibility,
-                            osg::Vec4f(sc.fog_color.osg(), 1.0f));
+                            osg::Vec4f(toOsg(sc.fog_color), 1.0f));
     return true;
 }
 
@@ -150,7 +150,7 @@ bool SGSky::reposition( const SGSkyState &st, const SGEphemeris& eph, double dt
     dome->reposition( st.zero_elev, st.alt, st.lon, st.lat, st.spin );
 
     osg::Matrix m = osg::Matrix::rotate(angleRad, osg::Vec3(0, 0, -1));
-    m.postMultTranslate(st.view_pos.osg());
+    m.postMultTranslate(toOsg(st.view_pos));
     _ephTransform->setMatrix(m);
 
     double sun_ra = eph.getSunRightAscension();
index e35e638e9c2e050cfc365198735a77037efff9a5..9be3f6de21b6ec6bcd34b1098acf8c5e934ad9a7 100644 (file)
@@ -35,15 +35,15 @@ void GroundLightManager::update(const SGUpdateVisitor* updateVisitor)
     SGVec4f fogColor = updateVisitor->getFogColor();
     fog = static_cast<osg::Fog*>(runwayLightSS
                                  ->getAttribute(StateAttribute::FOG));
-    fog->setColor(fogColor.osg());
+    fog->setColor(toOsg(fogColor));
     fog->setDensity(updateVisitor->getRunwayFogExp2Density());
     fog = static_cast<osg::Fog*>(taxiLightSS
                                  ->getAttribute(StateAttribute::FOG));
-    fog->setColor(fogColor.osg());
+    fog->setColor(toOsg(fogColor));
     fog->setDensity(updateVisitor->getTaxiFogExp2Density());
     fog = static_cast<osg::Fog*>(groundLightSS
                                  ->getAttribute(StateAttribute::FOG));
-    fog->setColor(fogColor.osg());
+    fog->setColor(toOsg(fogColor));
     fog->setDensity(updateVisitor->getGroundLightsFogExp2Density());
 }
 
index 9ff60f3e0c8729b84371968b5bef7ef0af3655fe..34a0bba788a71f3e73def79a2d30c7e4c448ad53 100644 (file)
@@ -140,9 +140,9 @@ void OceanMesh::calcMesh(const SGVec3d& cartCenter, const SGQuatd& orient,
   
     for (int j = 0; j < latPoints; j++) {
         for (int i = 0; i < lonPoints; ++i) {
-            vlArray(j, i) = rel[j][i].osg();
-            nlArray(j, i) = normals[j][i].osg();
-            tlArray(j, i) = texsArray(j, i).toSGVec2f().osg();
+            vlArray(j, i) = toOsg(rel[j][i]);
+            nlArray(j, i) = toOsg(normals[j][i]);
+            tlArray(j, i) = toOsg(texsArray(j, i).toSGVec2f());
         }
     }
 
@@ -313,8 +313,8 @@ osg::Node* SGOceanTile(const SGBucket& b, SGMaterialLib *matlib)
 
     osg::MatrixTransform* transform = new osg::MatrixTransform;
     transform->setName("Ocean");
-    transform->setMatrix(osg::Matrix::rotate(hlOr.osg())*
-                         osg::Matrix::translate(cartCenter.osg()));
+    transform->setMatrix(osg::Matrix::rotate(toOsg(hlOr))*
+                         osg::Matrix::translate(toOsg(cartCenter)));
     transform->addChild(geode);
   
     return transform;
index 97e1aebc92501b3076822d49ccb3c7cf81f96960..3df4280a123afb824bbc93fa5053736daa912cd3 100644 (file)
@@ -309,25 +309,25 @@ public:
       triangle_ref triangle = triangles[i];
       if (indexMap[triangle[0]] == invalid) {
         indexMap[triangle[0]] = vertices->size();
-        vertices->push_back(getVertex(triangle[0]).vertex.osg());
-        normals->push_back(getVertex(triangle[0]).normal.osg());
-        texCoords->push_back(getVertex(triangle[0]).texCoord.osg());
+        vertices->push_back(toOsg(getVertex(triangle[0]).vertex));
+        normals->push_back(toOsg(getVertex(triangle[0]).normal));
+        texCoords->push_back(toOsg(getVertex(triangle[0]).texCoord));
       }
       deFacade.push_back(indexMap[triangle[0]]);
 
       if (indexMap[triangle[1]] == invalid) {
         indexMap[triangle[1]] = vertices->size();
-        vertices->push_back(getVertex(triangle[1]).vertex.osg());
-        normals->push_back(getVertex(triangle[1]).normal.osg());
-        texCoords->push_back(getVertex(triangle[1]).texCoord.osg());
+        vertices->push_back(toOsg(getVertex(triangle[1]).vertex));
+        normals->push_back(toOsg(getVertex(triangle[1]).normal));
+        texCoords->push_back(toOsg(getVertex(triangle[1]).texCoord));
       }
       deFacade.push_back(indexMap[triangle[1]]);
 
       if (indexMap[triangle[2]] == invalid) {
         indexMap[triangle[2]] = vertices->size();
-        vertices->push_back(getVertex(triangle[2]).vertex.osg());
-        normals->push_back(getVertex(triangle[2]).normal.osg());
-        texCoords->push_back(getVertex(triangle[2]).texCoord.osg());
+        vertices->push_back(toOsg(getVertex(triangle[2]).vertex));
+        normals->push_back(toOsg(getVertex(triangle[2]).normal));
+        texCoords->push_back(toOsg(getVertex(triangle[2]).texCoord));
       }
       deFacade.push_back(indexMap[triangle[2]]);
     }
index 24e553881e776f98c85ae47d2e1b4df87540c8fc..bc9b662cf327d9353bdad77abe07751d1cf5ac9e 100644 (file)
@@ -94,7 +94,7 @@ SGVasiDrawable::drawImplementation(osg::RenderInfo& renderInfo) const
   // Retrieve the eye point in local coords
   osg::Matrix m;
   m.invert(renderInfo.getState()->getModelViewMatrix());
-  SGVec3f eyePoint(m.preMult(osg::Vec3(0, 0, 0)));
+  SGVec3f eyePoint(toSG(m.preMult(osg::Vec3(0, 0, 0))));
   
   // paint the points
   for (unsigned i = 0; i < _lights.size(); ++i)
@@ -106,7 +106,7 @@ SGVasiDrawable::computeBound() const
 {
   osg::BoundingBox bb;
   for (unsigned i = 0; i < _lights.size(); ++i)
-    bb.expandBy(_lights[i].position.osg());
+    bb.expandBy(toOsg(_lights[i].position));
   
   // blow up to avoid being victim to small feature culling ...
   bb.expandBy(bb._min - osg::Vec3(1, 1, 1));
index b02307dbfc42b021788eb6229b1eb9f7c4c89e52..8c639139a1db4e0a65beb0eafcbfb7c2aa939d7d 100644 (file)
@@ -181,7 +181,7 @@ Geode* createTreeGeode(float width, float height, int varieties)
 
 void addTreeToLeafGeode(Geode* geode, const SGVec3f& p)
 {
-    const Vec3& pos = p.osg();
+    Vec3 pos = toOsg(p);
     unsigned int numDrawables = geode->getNumDrawables();
     Geometry* geom
         = static_cast<Geometry*>(geode->getDrawable(numDrawables - 1));
@@ -287,7 +287,7 @@ struct GetTreeCoord
 {
     Vec3 operator() (const TreeBin::Tree& tree) const
     {
-        return tree.position.osg();
+        return toOsg(tree.position);
     }
 };
 
@@ -300,8 +300,8 @@ struct TreeTransformer
     TreeTransformer(Matrix& mat_) : mat(mat_) {}
     TreeBin::Tree operator()(const TreeBin::Tree& tree) const
     {
-        const Vec3& pos = tree.position.osg();
-        return TreeBin::Tree(SGVec3f(pos * mat));
+        Vec3 pos = toOsg(tree.position);
+        return TreeBin::Tree(toSG(pos * mat));
     }
     Matrix mat;
 };
index 54e3ef164735a99f0e205606b949a4cbf00a665d..74b4a0718be358aa2ab5206d3a10c59d43ab7456 100644 (file)
@@ -616,7 +616,7 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool
           // location, and then apply the rotation matrix created
           // above, with an additional random heading rotation if appropriate.
           osg::Matrix transformMat;
-          transformMat = osg::Matrix::translate(obj.position.osg());
+          transformMat = osg::Matrix::translate(toOsg(obj.position));
           if (obj.model->get_heading_type() == SGMatModel::HEADING_RANDOM) {
             // Rotate the object around the z axis.
             double hdg = mt_rand(&seed) * M_PI * 2;
@@ -758,8 +758,8 @@ SGLoadBTG(const std::string& path, SGMaterialLib *matlib, bool calc_lights, bool
   // The toplevel transform for that tile.
   osg::MatrixTransform* transform = new osg::MatrixTransform;
   transform->setName(path);
-  transform->setMatrix(osg::Matrix::rotate(hlOr.osg())*
-                       osg::Matrix::translate(center.osg()));
+  transform->setMatrix(osg::Matrix::rotate(toOsg(hlOr))*
+                       osg::Matrix::translate(toOsg(center)));
   transform->addChild(terrainGroup);
   if (lightGroup->getNumChildren() > 0) {
     osg::LOD* lightLOD = new osg::LOD;
index e15b7beaae44367220cd3a26124bb80453998ab7..bfe3c5ae963544aaab92c694afc79d79cdce94e3 100644 (file)
@@ -237,8 +237,8 @@ SGLightFactory::getLightDrawable(const SGLightBin::Light& light)
   osg::Vec3Array* vertices = new osg::Vec3Array;
   osg::Vec4Array* colors = new osg::Vec4Array;
 
-  vertices->push_back(light.position.osg());
-  colors->push_back(light.color.osg());
+  vertices->push_back(toOsg(light.position));
+  colors->push_back(toOsg(light.color));
   
   osg::Geometry* geometry = new osg::Geometry;
   geometry->setVertexArray(vertices);
@@ -270,12 +270,12 @@ SGLightFactory::getLightDrawable(const SGDirectionalLightBin::Light& light)
   SGVec3f perp1 = perpendicular(normal);
   SGVec3f perp2 = cross(normal, perp1);
   SGVec3f position = light.position;
-  vertices->push_back(position.osg());
-  vertices->push_back((position + perp1).osg());
-  vertices->push_back((position + perp2).osg());
-  colors->push_back(visibleColor.osg());
-  colors->push_back(invisibleColor.osg());
-  colors->push_back(invisibleColor.osg());
+  vertices->push_back(toOsg(position));
+  vertices->push_back(toOsg(position + perp1));
+  vertices->push_back(toOsg(position + perp2));
+  colors->push_back(toOsg(visibleColor));
+  colors->push_back(toOsg(invisibleColor));
+  colors->push_back(toOsg(invisibleColor));
   
   osg::Geometry* geometry = new osg::Geometry;
   geometry->setVertexArray(vertices);
@@ -307,10 +307,10 @@ SGLightFactory::getLights(const SGLightBin& lights, unsigned inc, float alphaOff
   osg::Vec4Array* colors = new osg::Vec4Array;
 
   for (unsigned i = 0; i < lights.getNumLights(); i += inc) {
-    vertices->push_back(lights.getLight(i).position.osg());
+    vertices->push_back(toOsg(lights.getLight(i).position));
     SGVec4f color = lights.getLight(i).color;
     color[3] = SGMiscf::max(0, SGMiscf::min(1, color[3] + alphaOff));
-    colors->push_back(color.osg());
+    colors->push_back(toOsg(color));
   }
   
   osg::Geometry* geometry = new osg::Geometry;
@@ -358,12 +358,12 @@ SGLightFactory::getLights(const SGDirectionalLightBin& lights)
     SGVec3f perp1 = perpendicular(normal);
     SGVec3f perp2 = cross(normal, perp1);
     SGVec3f position = lights.getLight(i).position;
-    vertices->push_back(position.osg());
-    vertices->push_back((position + perp1).osg());
-    vertices->push_back((position + perp2).osg());
-    colors->push_back(visibleColor.osg());
-    colors->push_back(invisibleColor.osg());
-    colors->push_back(invisibleColor.osg());
+    vertices->push_back(toOsg(position));
+    vertices->push_back(toOsg(position + perp1));
+    vertices->push_back(toOsg(position + perp2));
+    colors->push_back(toOsg(visibleColor));
+    colors->push_back(toOsg(invisibleColor));
+    colors->push_back(toOsg(invisibleColor));
   }
   
   osg::Geometry* geometry = new osg::Geometry;
index 0f640b666bf44e86762731d77c5716265f2748cf..251459a721e5f7484e79d15697fa6bd893331cbb 100644 (file)
@@ -40,7 +40,7 @@ public:
                    const SGQuatd& globalViewOrientation)
   {
     mGlobalGeodEyePos = SGGeod::fromCart(globalEyePos);
-    _currentEyePos = globalEyePos.osg();
+    _currentEyePos = toOsg(globalEyePos);
     mGlobalEyePos = globalEyePos;
     mGlobalViewOr = globalViewOrientation;
     mGlobalHorizLocalOr = SGQuatd::fromLonLat(mGlobalGeodEyePos);