]> git.mxchange.org Git - simgear.git/commitdiff
Replace SGPlacementTrans usage with osg::PositionAttitueTransform.
authorfrohlich <frohlich>
Sat, 6 Jun 2009 08:07:20 +0000 (08:07 +0000)
committerTim Moore <timoore@redhat.com>
Thu, 11 Jun 2009 13:55:10 +0000 (15:55 +0200)
Remove SGPlacementTrans.
Update build system.

Modified Files:
SimGear.dsp projects/VC7.1/SimGear.vcproj
projects/VC8/SimGear.vcproj simgear/scene/model/Makefile.am
simgear/scene/model/placement.cxx
simgear/scene/model/placement.hxx
simgear/scene/tgdb/TileEntry.cxx
simgear/scene/tgdb/TileEntry.hxx
Removed Files:
  simgear/scene/model/placementtrans.cxx
  simgear/scene/model/placementtrans.hxx

SimGear.dsp
projects/VC7.1/SimGear.vcproj
projects/VC8/SimGear.vcproj
simgear/scene/model/Makefile.am
simgear/scene/model/placement.cxx
simgear/scene/model/placement.hxx
simgear/scene/model/placementtrans.cxx [deleted file]
simgear/scene/model/placementtrans.hxx [deleted file]
simgear/scene/tgdb/TileEntry.cxx
simgear/scene/tgdb/TileEntry.hxx

index 9864af726a8f76b5ad0599712be7e9d2e7a9eeee..e79cc932e9101c2aeb9d2987a8f9e61e34ed99c2 100644 (file)
@@ -1334,21 +1334,6 @@ SOURCE=.\simgear\scene\model\placement.cxx
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\simgear\scene\model\placementtrans.cxx\r
-\r
-!IF  "$(CFG)" == "SimGear - Win32 Release"\r
-\r
-# PROP Intermediate_Dir "Release\Lib_sgmodel"\r
-\r
-!ELSEIF  "$(CFG)" == "SimGear - Win32 Debug"\r
-\r
-# PROP Intermediate_Dir "Debug\Lib_sgmodel"\r
-\r
-!ENDIF \r
-\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\simgear\scene\model\shadanim.cxx\r
 \r
 !IF  "$(CFG)" == "SimGear - Win32 Release"\r
index 2ee3c73c3338dab1085cf6abf7f5acfa046df8a5..ae791bd2e19f5bb9eb224ec4d2002172165df7b0 100755 (executable)
                        <File
                                RelativePath="..\..\simgear\scene\model\placement.hxx">
                        </File>
-                       <File
-                               RelativePath="..\..\simgear\scene\model\placementtrans.cxx">
-                       </File>
-                       <File
-                               RelativePath="..\..\simgear\scene\model\placementtrans.hxx">
-                       </File>
                        <File
                                RelativePath="..\..\simgear\scene\model\SGClipGroup.cxx">
                        </File>
index 5e159dc82639bd0df9d081f5ee675556a91bbbb7..3c59746676f770c8e2f114061f14fae766cd1189 100755 (executable)
                                RelativePath="..\..\simgear\scene\model\placement.hxx"\r
                                >\r
                        </File>\r
-                       <File\r
-                               RelativePath="..\..\simgear\scene\model\placementtrans.hxx"\r
-                               >\r
-                       </File>\r
                        <File\r
                                RelativePath="..\..\simgear\ephemeris\pluto.hxx"\r
                                >\r
                                RelativePath="..\..\simgear\scene\model\placement.cxx"\r
                                >\r
                        </File>\r
-                       <File\r
-                               RelativePath="..\..\simgear\scene\model\placementtrans.cxx"\r
-                               >\r
-                       </File>\r
                        <File\r
                                RelativePath="..\..\simgear\props\props.cxx"\r
                                >\r
index 82108d5a82cdb0866c17804f320c272859b782cc..3bf59ff06a66f0e3ab52952a7c8fa2c3e7f28850 100644 (file)
@@ -12,7 +12,6 @@ include_HEADERS = \
        ModelRegistry.hxx \
        persparam.hxx \
        placement.hxx \
-       placementtrans.hxx \
        CheckSceneryVisitor.hxx \
        SGClipGroup.hxx \
        SGMaterialAnimation.hxx \
@@ -32,7 +31,6 @@ libsgmodel_a_SOURCES = \
        ModelRegistry.cxx \
        persparam.cxx \
        placement.cxx \
-       placementtrans.cxx \
        shadanim.cxx \
        CheckSceneryVisitor.cxx \
        SGClipGroup.cxx \
index 9da016ef89b13020fafda51a5fc0cfbf95a4fdaf..486113d8287eba2fcd4becbcb47b513a9753575a 100644 (file)
@@ -7,13 +7,10 @@
 #include <simgear_config.h>
 #endif
 
-#include <simgear/compiler.h>
-
-#include <simgear/scene/util/SGSceneUserData.hxx>
-#include <simgear/scene/util/SGUpdateVisitor.hxx>
-
 #include "placement.hxx"
 
+#include <simgear/compiler.h>
+#include <simgear/scene/util/SGSceneUserData.hxx>
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -26,7 +23,7 @@ SGModelPlacement::SGModelPlacement () :
     _pitch_deg(0),
     _heading_deg(0),
     _selector(new osg::Switch),
-    _transform(new SGPlacementTransform)
+    _transform(new osg::PositionAttitudeTransform)
 {
 }
 
@@ -49,6 +46,7 @@ SGModelPlacement::update()
 {
   // The cartesian position
   SGVec3d position = SGVec3d::fromGeod(_position);
+  _transform->setPosition(position.osg());
 
   // The orientation, composed from the horizontal local orientation and the
   // orientation wrt the horizontal local frame
@@ -58,7 +56,7 @@ SGModelPlacement::update()
   // the y axis 180 degrees.
   orient *= SGQuatd::fromRealImag(0, SGVec3d(0, 1, 0));
 
-  _transform->setTransform(position, orient);
+  _transform->setAttitude(orient.osg());
 }
 
 bool
index 9a7236609753dcc00a8bda0cd83abdda29e4ac62..97d5cda5e46305e47dc835e1980069d5bb7d2475 100644 (file)
 #include <osg/ref_ptr>
 #include <osg/Node>
 #include <osg/Switch>
+#include <osg/PositionAttitudeTransform>
 
-#include <simgear/props/props.hxx>
-
-#include "placementtrans.hxx"
+#include <simgear/math/SGMath.hxx>
 
 // Has anyone done anything *really* stupid, like making min and max macros?
 #ifdef min
@@ -78,7 +77,6 @@ public:
   void setBodyAngularVelocity(const SGVec3d& velocity);
   
 private:
-
                                 // Geodetic position
   SGGeod _position;
 
@@ -88,7 +86,7 @@ private:
   double _heading_deg;
 
   osg::ref_ptr<osg::Switch> _selector;
-  osg::ref_ptr<SGPlacementTransform> _transform;
+  osg::ref_ptr<osg::PositionAttitudeTransform> _transform;
 };
 
 #endif // _SG_PLACEMENT_HXX
diff --git a/simgear/scene/model/placementtrans.cxx b/simgear/scene/model/placementtrans.cxx
deleted file mode 100644 (file)
index 14d8491..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-// placementtrans.hxx -- class for carrying transforms for placing models in the world
-//
-// Written by Mathias Froehlich, started April 2005.
-//
-// Copyright (C) 2005 Mathias Froehlich
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-//
-
-#ifdef HAVE_CONFIG_H
-#  include <simgear_config.h>
-#endif
-
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
-#include <osgDB/Registry>
-#include <osgDB/Input>
-#include <osgDB/Output>
-
-#include <simgear/compiler.h>
-#include <simgear/constants.h>
-
-#include "placementtrans.hxx"
-
-SGPlacementTransform::SGPlacementTransform(void) :
-  _placement_offset(0, 0, 0),
-  _rotation(SGQuatd::unit())
-{
-}
-
-SGPlacementTransform::SGPlacementTransform(const SGPlacementTransform& trans,
-                                           const osg::CopyOp& copyop):
-  osg::Transform(trans, copyop),
-  _placement_offset(trans._placement_offset),
-  _rotation(trans._rotation)
-{
-  
-}
-
-SGPlacementTransform::~SGPlacementTransform(void)
-{
-}
-
-bool
-SGPlacementTransform::computeLocalToWorldMatrix(osg::Matrix& matrix,
-                                                osg::NodeVisitor*) const
-{
-  if (_referenceFrame == RELATIVE_RF) {
-    matrix.preMultTranslate(_placement_offset.osg());
-    matrix.preMultRotate(_rotation.osg());
-  } else {
-    matrix.makeRotate(_rotation.osg());
-    matrix.postMultTranslate(_placement_offset.osg());
-  }
-  return true;
-}
-
-bool
-SGPlacementTransform::computeWorldToLocalMatrix(osg::Matrix& matrix,
-                                                osg::NodeVisitor*) const
-{
-  if (_referenceFrame == RELATIVE_RF) {
-    matrix.postMultTranslate(-_placement_offset.osg());
-    matrix.postMultRotate(inverse(_rotation).osg());
-  } else {
-    matrix.makeRotate(inverse(_rotation).osg());
-    matrix.preMultTranslate(-_placement_offset.osg());
-  }
-  return true;
-}
-
-// Functions to read / write SGPlacementTrans from / to a .osg file,
-// mostly for debugging purposes.
-
-namespace {
-
-bool PlacementTrans_readLocalData(osg::Object& obj, osgDB::Input& fr)
-{
-    SGPlacementTransform& trans = static_cast<SGPlacementTransform&>(obj);
-    SGQuatd rotation = SGQuatd::unit();
-    SGVec3d placementOffset(0, 0, 0);
-    
-    if (fr[0].matchWord("rotation")) {
-        ++fr;
-        osg::Vec4d vec4;
-        if (fr.readSequence(vec4)) {
-            rotation = SGQuatd(vec4[0], vec4[1], vec4[2], vec4[3]);
-            fr += 4;
-        } else
-            return false;
-    }
-    if (fr[0].matchWord("placement")) {
-        ++fr;
-        if (fr.readSequence(placementOffset.osg()))
-            fr += 3;
-        else
-            return false;
-    }
-    trans.setTransform(placementOffset, rotation);
-    return true;
-}
-
-bool PlacementTrans_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
-{
-    const SGPlacementTransform& trans
-        = static_cast<const SGPlacementTransform&>(obj);
-    const SGQuatd& rotation = trans.getRotation();
-    const SGVec3d& placement = trans.getGlobalPos();
-    
-    fw.indent() << "rotation ";
-    for (int i = 0; i < 4; i++) {
-        fw << rotation(i) << " ";
-    }
-    fw << std::endl;
-    int prec = fw.precision();
-    fw.precision(15);
-    fw.indent() << "placement ";
-    for (int i = 0; i < 3; i++) {
-        fw << placement(i) << " ";
-    }
-    fw << std::endl;
-    fw.precision(prec);
-    return true;
-}
-}
-
-osgDB::RegisterDotOsgWrapperProxy g_SGPlacementTransProxy
-(
-    new SGPlacementTransform,
-    "SGPlacementTransform",
-    "Object Node Transform SGPlacementTransform Group",
-    &PlacementTrans_readLocalData,
-    &PlacementTrans_writeLocalData
-);
diff --git a/simgear/scene/model/placementtrans.hxx b/simgear/scene/model/placementtrans.hxx
deleted file mode 100644 (file)
index b4489bb..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// placementtrans.hxx -- class for carrying transforms for placing models in the world
-//
-// Written by Mathias Froehlich, started April 2005.
-//
-// Copyright (C) 2005 Mathias Froehlich
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License as
-// published by the Free Software Foundation; either version 2 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-//
-
-
-#ifndef _SG_PLACEMENTTRANS_HXX
-#define _SG_PLACEMENTTRANS_HXX
-
-#ifndef __cplusplus
-# error This library requires C++
-#endif
-
-#include <simgear/compiler.h>
-#include <simgear/constants.h>
-#include <simgear/math/SGMath.hxx>
-
-#include <osg/Transform>
-
-class SGPlacementTransform : public osg::Transform
-{
-public:
-  
-  SGPlacementTransform(void);
-  SGPlacementTransform(const SGPlacementTransform&,
-                       const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
-
-  META_Node(simgear, SGPlacementTransform);
-  
-  void setTransform(const SGVec3d& off)
-  { _placement_offset = off; dirtyBound(); }
-  void setTransform(const SGVec3d& off, const SGQuatd& rot)
-  { _placement_offset = off; _rotation = rot; dirtyBound(); }
-  
-  const SGVec3d& getGlobalPos() const
-  { return _placement_offset; }
-  const SGQuatd& getRotation() const
-  { return _rotation; }
-  
-  virtual bool computeLocalToWorldMatrix(osg::Matrix&,osg::NodeVisitor*) const;
-  virtual bool computeWorldToLocalMatrix(osg::Matrix&,osg::NodeVisitor*) const;
-
-protected:
-  virtual ~SGPlacementTransform(void);
-
-private:
-
-  class UpdateCallback;
-
-  //////////////////////////////////////////////////////////////////
-  // private data                                                 //
-  //////////////////////////////////////////////////////////////////
-  
-  SGVec3d _placement_offset;
-  SGQuatd _rotation;
-};
-
-#endif // _SG_LOCATION_HXX
index 772c6704d6da85f90f5fd0896716be9f1b05ae2d..0a33e3263dfb3dc39fcbc96615bdeea4762ab797 100644 (file)
@@ -55,7 +55,6 @@
 #include <simgear/scene/tgdb/apt_signs.hxx>
 #include <simgear/scene/tgdb/obj.hxx>
 #include <simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx>
-#include <simgear/scene/model/placementtrans.hxx>
 
 #include "ReaderWriterSTG.hxx"
 #include "TileEntry.hxx"
index d12fa92009e9b3a725a7171f0a82774932fe4105..287a95139dc423d797bc904bbcb8d989cf985d82 100644 (file)
@@ -37,7 +37,6 @@
 #include <simgear/bucket/newbucket.hxx>
 #include <simgear/math/point3d.hxx>
 #include <simgear/misc/sg_path.hxx>
-#include <simgear/scene/model/placementtrans.hxx>
 
 #include <osg/ref_ptr>
 #include <osgDB/ReaderWriter>