00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _SG_PLACEMENTTRANS_HXX
00024 #define _SG_PLACEMENTTRANS_HXX
00025
00026 #ifndef __cplusplus
00027 # error This library requires C++
00028 #endif
00029
00030 #include <simgear/compiler.h>
00031 #include <simgear/constants.h>
00032 #include <simgear/math/SGMath.hxx>
00033
00034 #include <osg/Transform>
00035
00036 class SGPlacementTransform : public osg::Transform
00037 {
00038 public:
00039
00040 SGPlacementTransform(void);
00041 SGPlacementTransform(const SGPlacementTransform&,
00042 const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
00043
00044 META_Node(simgear, SGPlacementTransform);
00045
00046 void setTransform(const SGVec3d& off)
00047 { _placement_offset = off; dirtyBound(); }
00048 void setTransform(const SGVec3d& off, const SGMatrixd& rot)
00049 { _placement_offset = off; _rotation = rot; dirtyBound(); }
00050 void setSceneryCenter(const SGVec3d& center)
00051 { _scenery_center = center; dirtyBound(); }
00052
00053 const SGVec3d& getGlobalPos() const
00054 { return _placement_offset; }
00055 const SGMatrixd& getRotation() const { return _rotation; }
00056 const SGVec3d& getSceneryCenter() const { return _scenery_center; }
00057
00058 virtual bool computeLocalToWorldMatrix(osg::Matrix&,osg::NodeVisitor*) const;
00059 virtual bool computeWorldToLocalMatrix(osg::Matrix&,osg::NodeVisitor*) const;
00060
00061 protected:
00062 virtual ~SGPlacementTransform(void);
00063
00064 private:
00065
00066 class UpdateCallback;
00067
00069
00071
00072 SGVec3d _placement_offset;
00073 SGVec3d _scenery_center;
00074 SGMatrixd _rotation;
00075 };
00076
00077 #endif // _SG_LOCATION_HXX