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
# 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
<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>
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
ModelRegistry.hxx \
persparam.hxx \
placement.hxx \
- placementtrans.hxx \
CheckSceneryVisitor.hxx \
SGClipGroup.hxx \
SGMaterialAnimation.hxx \
ModelRegistry.cxx \
persparam.cxx \
placement.cxx \
- placementtrans.cxx \
shadanim.cxx \
CheckSceneryVisitor.cxx \
SGClipGroup.cxx \
#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
////////////////////////////////////////////////////////////////////////
_pitch_deg(0),
_heading_deg(0),
_selector(new osg::Switch),
- _transform(new SGPlacementTransform)
+ _transform(new osg::PositionAttitudeTransform)
{
}
{
// 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
// the y axis 180 degrees.
orient *= SGQuatd::fromRealImag(0, SGVec3d(0, 1, 0));
- _transform->setTransform(position, orient);
+ _transform->setAttitude(orient.osg());
}
bool
#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
void setBodyAngularVelocity(const SGVec3d& velocity);
private:
-
// Geodetic position
SGGeod _position;
double _heading_deg;
osg::ref_ptr<osg::Switch> _selector;
- osg::ref_ptr<SGPlacementTransform> _transform;
+ osg::ref_ptr<osg::PositionAttitudeTransform> _transform;
};
#endif // _SG_PLACEMENT_HXX
+++ /dev/null
-// 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
-);
+++ /dev/null
-// 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
#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"
#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>