From Serge Lages, "Here you can find some modifications to osgManipulator to work with double values instead of floats. Indeed I faced problems with the osgManipulator library when working with Earth based scenes, it was impossible to drag objects in a precise way if they were too far from the center of the scene."
This commit is contained in:
@@ -34,8 +34,8 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform
|
||||
{
|
||||
public :
|
||||
AntiSquish();
|
||||
AntiSquish(const osg::Vec3& pivot);
|
||||
AntiSquish(const osg::Vec3& pivot, const osg::Vec3& position);
|
||||
AntiSquish(const osg::Vec3d& pivot);
|
||||
AntiSquish(const osg::Vec3d& pivot, const osg::Vec3d& position);
|
||||
AntiSquish(const AntiSquish& pat, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
virtual osg::Object* cloneType() const { return new AntiSquish(); }
|
||||
@@ -44,23 +44,23 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform
|
||||
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const AntiSquish *>(obj)!=NULL; }
|
||||
|
||||
void setPivot(const osg::Vec3& pvt)
|
||||
void setPivot(const osg::Vec3d& pvt)
|
||||
{
|
||||
_pivot = pvt;
|
||||
_usePivot = true;
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
const osg::Vec3& getPivot() { return _pivot; }
|
||||
const osg::Vec3d& getPivot() { return _pivot; }
|
||||
|
||||
void setPosition(const osg::Vec3& pos)
|
||||
void setPosition(const osg::Vec3d& pos)
|
||||
{
|
||||
_position = pos;
|
||||
_usePosition = true;
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
const osg::Vec3& getPosition() { return _position; }
|
||||
const osg::Vec3d& getPosition() { return _position; }
|
||||
|
||||
virtual ~AntiSquish();
|
||||
|
||||
@@ -70,10 +70,10 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform
|
||||
|
||||
osg::NodeCallback* _asqCallback;
|
||||
|
||||
osg::Vec3 _pivot;
|
||||
osg::Vec3d _pivot;
|
||||
bool _usePivot;
|
||||
|
||||
osg::Vec3 _position;
|
||||
osg::Vec3d _position;
|
||||
bool _usePosition;
|
||||
|
||||
bool _dirty;
|
||||
|
||||
@@ -138,7 +138,7 @@ class OSGMANIPULATOR_EXPORT TranslateInLineCommand : public MotionCommand
|
||||
inline const osg::LineSegment::vec_type& getLineEnd() const { return _line->end(); }
|
||||
|
||||
inline void setTranslation(const osg::Vec3& t) { _translation = t; }
|
||||
inline const osg::Vec3& getTranslation() const { return _translation; }
|
||||
inline const osg::Vec3d& getTranslation() const { return _translation; }
|
||||
|
||||
virtual osg::Matrix getMotionMatrix() const
|
||||
{
|
||||
@@ -151,7 +151,7 @@ class OSGMANIPULATOR_EXPORT TranslateInLineCommand : public MotionCommand
|
||||
|
||||
private:
|
||||
osg::ref_ptr<osg::LineSegment> _line;
|
||||
osg::Vec3 _translation;
|
||||
osg::Vec3d _translation;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -172,12 +172,12 @@ class OSGMANIPULATOR_EXPORT TranslateInPlaneCommand : public MotionCommand
|
||||
inline void setPlane(const osg::Plane& plane) { _plane = plane; }
|
||||
inline const osg::Plane& getPlane() const { return _plane; }
|
||||
|
||||
inline void setTranslation(const osg::Vec3& t) { _translation = t; }
|
||||
inline const osg::Vec3& getTranslation() const { return _translation; }
|
||||
inline void setTranslation(const osg::Vec3d& t) { _translation = t; }
|
||||
inline const osg::Vec3d& getTranslation() const { return _translation; }
|
||||
|
||||
/** ReferencePoint is used only for snapping. */
|
||||
inline void setReferencePoint(const osg::Vec3& rp) { _referencePoint = rp; }
|
||||
inline const osg::Vec3& getReferencePoint() const { return _referencePoint; }
|
||||
inline void setReferencePoint(const osg::Vec3d& rp) { _referencePoint = rp; }
|
||||
inline const osg::Vec3d& getReferencePoint() const { return _referencePoint; }
|
||||
|
||||
virtual osg::Matrix getMotionMatrix() const
|
||||
{
|
||||
@@ -190,8 +190,8 @@ class OSGMANIPULATOR_EXPORT TranslateInPlaneCommand : public MotionCommand
|
||||
|
||||
private:
|
||||
osg::Plane _plane;
|
||||
osg::Vec3 _translation;
|
||||
osg::Vec3 _referencePoint;
|
||||
osg::Vec3d _translation;
|
||||
osg::Vec3d _referencePoint;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -207,18 +207,18 @@ class OSGMANIPULATOR_EXPORT Scale1DCommand : public MotionCommand
|
||||
virtual bool unexecute();
|
||||
virtual void applyConstraint(const Constraint*);
|
||||
|
||||
inline void setScale(float s) { _scale = s; }
|
||||
inline float getScale() const { return _scale; }
|
||||
inline void setScale(double s) { _scale = s; }
|
||||
inline double getScale() const { return _scale; }
|
||||
|
||||
inline void setScaleCenter(float center) { _scaleCenter = center; }
|
||||
inline float getScaleCenter() const { return _scaleCenter; }
|
||||
inline void setScaleCenter(double center) { _scaleCenter = center; }
|
||||
inline double getScaleCenter() const { return _scaleCenter; }
|
||||
|
||||
/** ReferencePoint is used only for snapping. */
|
||||
inline void setReferencePoint(float rp) { _referencePoint = rp; }
|
||||
inline float getReferencePoint() const { return _referencePoint; }
|
||||
inline void setReferencePoint(double rp) { _referencePoint = rp; }
|
||||
inline double getReferencePoint() const { return _referencePoint; }
|
||||
|
||||
inline void setMinScale(float min) { _minScale = min; }
|
||||
inline float getMinScale() const { return _minScale; }
|
||||
inline void setMinScale(double min) { _minScale = min; }
|
||||
inline double getMinScale() const { return _minScale; }
|
||||
|
||||
virtual osg::Matrix getMotionMatrix() const
|
||||
{
|
||||
@@ -232,10 +232,10 @@ class OSGMANIPULATOR_EXPORT Scale1DCommand : public MotionCommand
|
||||
virtual ~Scale1DCommand();
|
||||
|
||||
private:
|
||||
float _scale;
|
||||
float _scaleCenter;
|
||||
float _referencePoint;
|
||||
float _minScale;
|
||||
double _scale;
|
||||
double _scaleCenter;
|
||||
double _referencePoint;
|
||||
double _minScale;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -251,18 +251,18 @@ class OSGMANIPULATOR_EXPORT Scale2DCommand : public MotionCommand
|
||||
virtual bool unexecute();
|
||||
virtual void applyConstraint(const Constraint*);
|
||||
|
||||
inline void setScale(const osg::Vec2& s) { _scale = s; }
|
||||
inline const osg::Vec2& getScale() const { return _scale; }
|
||||
inline void setScale(const osg::Vec2d& s) { _scale = s; }
|
||||
inline const osg::Vec2d& getScale() const { return _scale; }
|
||||
|
||||
inline void setScaleCenter(const osg::Vec2& center) { _scaleCenter = center; }
|
||||
inline const osg::Vec2& getScaleCenter() const { return _scaleCenter; }
|
||||
inline void setScaleCenter(const osg::Vec2d& center) { _scaleCenter = center; }
|
||||
inline const osg::Vec2d& getScaleCenter() const { return _scaleCenter; }
|
||||
|
||||
/** ReferencePoint is used only for snapping. */
|
||||
inline void setReferencePoint(const osg::Vec2& rp) { _referencePoint = rp; }
|
||||
inline const osg::Vec2& getReferencePoint() const { return _referencePoint; }
|
||||
inline void setReferencePoint(const osg::Vec2d& rp) { _referencePoint = rp; }
|
||||
inline const osg::Vec2d& getReferencePoint() const { return _referencePoint; }
|
||||
|
||||
inline void setMinScale(const osg::Vec2& min) { _minScale = min; }
|
||||
inline const osg::Vec2& getMinScale() const { return _minScale; }
|
||||
inline void setMinScale(const osg::Vec2d& min) { _minScale = min; }
|
||||
inline const osg::Vec2d& getMinScale() const { return _minScale; }
|
||||
|
||||
virtual osg::Matrix getMotionMatrix() const
|
||||
{
|
||||
@@ -276,10 +276,10 @@ class OSGMANIPULATOR_EXPORT Scale2DCommand : public MotionCommand
|
||||
virtual ~Scale2DCommand();
|
||||
|
||||
private:
|
||||
osg::Vec2 _scale;
|
||||
osg::Vec2 _scaleCenter;
|
||||
osg::Vec2 _referencePoint;
|
||||
osg::Vec2 _minScale;
|
||||
osg::Vec2d _scale;
|
||||
osg::Vec2d _scaleCenter;
|
||||
osg::Vec2d _referencePoint;
|
||||
osg::Vec2d _minScale;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -295,11 +295,11 @@ class OSGMANIPULATOR_EXPORT ScaleUniformCommand : public MotionCommand
|
||||
virtual bool unexecute();
|
||||
virtual void applyConstraint(const Constraint*);
|
||||
|
||||
inline void setScale(float s) { _scale = s; }
|
||||
inline float getScale() const { return _scale; }
|
||||
inline void setScale(double s) { _scale = s; }
|
||||
inline double getScale() const { return _scale; }
|
||||
|
||||
inline void setScaleCenter(const osg::Vec3& center) { _scaleCenter = center; }
|
||||
inline const osg::Vec3& getScaleCenter() const { return _scaleCenter; }
|
||||
inline void setScaleCenter(const osg::Vec3d& center) { _scaleCenter = center; }
|
||||
inline const osg::Vec3d& getScaleCenter() const { return _scaleCenter; }
|
||||
|
||||
virtual osg::Matrix getMotionMatrix() const
|
||||
{
|
||||
@@ -313,8 +313,8 @@ class OSGMANIPULATOR_EXPORT ScaleUniformCommand : public MotionCommand
|
||||
virtual ~ScaleUniformCommand();
|
||||
|
||||
private:
|
||||
float _scale;
|
||||
osg::Vec3 _scaleCenter;
|
||||
double _scale;
|
||||
osg::Vec3d _scaleCenter;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,23 +59,23 @@ class OSGMANIPULATOR_EXPORT PointerInfo
|
||||
if (!completed()) ++_hitIter;
|
||||
}
|
||||
|
||||
typedef std::pair<osg::NodePath, osg::Vec3> NodePathIntersectionPair;
|
||||
typedef std::pair<osg::NodePath, osg::Vec3d> NodePathIntersectionPair;
|
||||
typedef std::list< NodePathIntersectionPair> IntersectionList;
|
||||
|
||||
|
||||
osg::Vec3 getLocalIntersectPoint() const { return _hitIter->second; }
|
||||
osg::Vec3d getLocalIntersectPoint() const { return _hitIter->second; }
|
||||
|
||||
|
||||
|
||||
void setNearFarPoints (osg::Vec3 nearPoint, osg::Vec3 farPoint) {
|
||||
void setNearFarPoints (osg::Vec3d nearPoint, osg::Vec3d farPoint) {
|
||||
_nearPoint = nearPoint;
|
||||
_farPoint=farPoint;
|
||||
_eyeDir = farPoint - nearPoint;
|
||||
}
|
||||
|
||||
const osg::Vec3& getEyeDir() const {return _eyeDir;}
|
||||
const osg::Vec3d& getEyeDir() const {return _eyeDir;}
|
||||
|
||||
void getNearFarPoints( osg::Vec3& nearPoint, osg::Vec3& farPoint) const {
|
||||
void getNearFarPoints( osg::Vec3d& nearPoint, osg::Vec3d& farPoint) const {
|
||||
nearPoint = _nearPoint;
|
||||
farPoint = _farPoint;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ class OSGMANIPULATOR_EXPORT PointerInfo
|
||||
_MVPW = camera->getViewMatrix() * camera->getProjectionMatrix();
|
||||
if (camera->getViewport()) _MVPW.postMult(camera->getViewport()->computeWindowMatrix());
|
||||
_inverseMVPW.invert(_MVPW);
|
||||
osg::Vec3 eye, center, up;
|
||||
osg::Vec3d eye, center, up;
|
||||
camera->getViewMatrix().getLookAt(eye, center, up);
|
||||
_eyeDir = eye - center;
|
||||
|
||||
@@ -99,12 +99,12 @@ class OSGMANIPULATOR_EXPORT PointerInfo
|
||||
{
|
||||
_MVPW.makeIdentity();
|
||||
_inverseMVPW.makeIdentity();
|
||||
_eyeDir = osg::Vec3(0,0,1);
|
||||
_eyeDir = osg::Vec3d(0,0,1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void addIntersection(const osg::NodePath& nodePath, const osg::Vec3& intersectionPoint)
|
||||
void addIntersection(const osg::NodePath& nodePath, const osg::Vec3d& intersectionPoint)
|
||||
{
|
||||
bool needToResetHitIter = _hitList.empty();
|
||||
_hitList.push_back(NodePathIntersectionPair(nodePath, intersectionPoint));
|
||||
@@ -113,10 +113,10 @@ class OSGMANIPULATOR_EXPORT PointerInfo
|
||||
|
||||
void setMousePosition(float pixel_x, float pixel_y)
|
||||
{
|
||||
projectWindowXYIntoObject(osg::Vec2(pixel_x, pixel_y), _nearPoint, _farPoint);
|
||||
projectWindowXYIntoObject(osg::Vec2d(pixel_x, pixel_y), _nearPoint, _farPoint);
|
||||
}
|
||||
protected:
|
||||
bool projectWindowXYIntoObject(const osg::Vec2& windowCoord, osg::Vec3& nearPoint, osg::Vec3& farPoint) const;
|
||||
bool projectWindowXYIntoObject(const osg::Vec2d& windowCoord, osg::Vec3d& nearPoint, osg::Vec3d& farPoint) const;
|
||||
|
||||
public:
|
||||
IntersectionList _hitList;
|
||||
@@ -124,8 +124,8 @@ class OSGMANIPULATOR_EXPORT PointerInfo
|
||||
|
||||
protected:
|
||||
|
||||
osg::Vec3 _nearPoint,_farPoint;
|
||||
osg::Vec3 _eyeDir;
|
||||
osg::Vec3d _nearPoint,_farPoint;
|
||||
osg::Vec3d _eyeDir;
|
||||
|
||||
osg::Matrix _MVPW;
|
||||
osg::Matrix _inverseMVPW;
|
||||
|
||||
@@ -40,7 +40,7 @@ class OSGMANIPULATOR_EXPORT Projector : public osg::Referenced
|
||||
* projecting window coordinates into object coordinates and vice versa.
|
||||
* Returns true on successful projection.
|
||||
*/
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3& projectedPoint) const = 0;
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const = 0;
|
||||
|
||||
/**
|
||||
* Sets the matrix for transforming the projector's local coordinate
|
||||
@@ -107,7 +107,7 @@ class OSGMANIPULATOR_EXPORT LineProjector : public Projector
|
||||
* coordinate (pointToProject) when projected onto the given line.
|
||||
* Returns true on successful projection.
|
||||
*/
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3& projectedPoint) const;
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -135,7 +135,7 @@ class OSGMANIPULATOR_EXPORT PlaneProjector : public Projector
|
||||
* coordinate (pointToProject) when projected onto the given plane.
|
||||
* Returns true on successful projection.
|
||||
*/
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3& projectedPoint) const;
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -163,7 +163,7 @@ class OSGMANIPULATOR_EXPORT SphereProjector : public Projector
|
||||
* coordinate (pointToProject) when projected onto the given sphere.
|
||||
* Returns true on successful projection.
|
||||
*/
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3& projectedPoint) const;
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const;
|
||||
|
||||
/**
|
||||
* Returns true is the point is in front of the cylinder given the eye
|
||||
@@ -198,7 +198,7 @@ class OSGMANIPULATOR_EXPORT SpherePlaneProjector : public SphereProjector
|
||||
* coordinate (pointToProject) when projected onto the given sphere.
|
||||
* Returns true on successful projection.
|
||||
*/
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3& projectedPoint) const;
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const;
|
||||
|
||||
/**
|
||||
* Returns true if the previous projection was on the sphere and false
|
||||
@@ -206,8 +206,8 @@ class OSGMANIPULATOR_EXPORT SpherePlaneProjector : public SphereProjector
|
||||
*/
|
||||
bool isProjectionOnSphere() const { return _onSphere; }
|
||||
|
||||
osg::Quat getRotation(const osg::Vec3& p1, bool p1OnSphere,
|
||||
const osg::Vec3& p2, bool p2OnSphere,
|
||||
osg::Quat getRotation(const osg::Vec3d& p1, bool p1OnSphere,
|
||||
const osg::Vec3d& p2, bool p2OnSphere,
|
||||
float radialFactor = 0.0f) const;
|
||||
|
||||
protected:
|
||||
@@ -232,7 +232,7 @@ class OSGMANIPULATOR_EXPORT CylinderProjector : public Projector
|
||||
inline void setCylinder(osg::Cylinder* cylinder)
|
||||
{
|
||||
_cylinder = cylinder;
|
||||
_cylinderAxis = osg::Vec3(0.0,0.0,1.0) * osg::Matrix(cylinder->getRotation());
|
||||
_cylinderAxis = osg::Vec3d(0.0,0.0,1.0) * osg::Matrix(cylinder->getRotation());
|
||||
_cylinderAxis.normalize();
|
||||
}
|
||||
inline const osg::Cylinder* getCylinder() const { return _cylinder.get(); }
|
||||
@@ -242,7 +242,7 @@ class OSGMANIPULATOR_EXPORT CylinderProjector : public Projector
|
||||
* coordinate (pointToProject) when projected onto the given plane.
|
||||
* Returns true on successful projection.
|
||||
*/
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3& projectedPoint) const;
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const;
|
||||
|
||||
|
||||
/**
|
||||
@@ -258,7 +258,7 @@ class OSGMANIPULATOR_EXPORT CylinderProjector : public Projector
|
||||
virtual ~CylinderProjector();
|
||||
|
||||
osg::ref_ptr<osg::Cylinder> _cylinder;
|
||||
osg::Vec3 _cylinderAxis;
|
||||
osg::Vec3d _cylinderAxis;
|
||||
bool _front;
|
||||
};
|
||||
|
||||
@@ -278,7 +278,7 @@ class OSGMANIPULATOR_EXPORT CylinderPlaneProjector : public CylinderProjector
|
||||
* coordinate (pointToProject) when projected onto the given plane.
|
||||
* Returns true on successful projection.
|
||||
*/
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3& projectedPoint) const;
|
||||
virtual bool project(const PointerInfo& pi, osg::Vec3d& projectedPoint) const;
|
||||
|
||||
/**
|
||||
* Returns true if the previous projection was on the cylinder and
|
||||
@@ -286,7 +286,7 @@ class OSGMANIPULATOR_EXPORT CylinderPlaneProjector : public CylinderProjector
|
||||
*/
|
||||
bool isProjectionOnCylinder() const { return _onCylinder; }
|
||||
|
||||
osg::Quat getRotation(const osg::Vec3& p1, bool p1OnCyl, const osg::Vec3& p2, bool p2OnCyl) const;
|
||||
osg::Quat getRotation(const osg::Vec3d& p1, bool p1OnCyl, const osg::Vec3d& p2, bool p2OnCyl) const;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -294,7 +294,7 @@ class OSGMANIPULATOR_EXPORT CylinderPlaneProjector : public CylinderProjector
|
||||
|
||||
mutable osg::Plane _plane;
|
||||
mutable bool _onCylinder;
|
||||
mutable osg::Vec3 _planeLineStart, _planeLineEnd;
|
||||
mutable osg::Vec3d _planeLineStart, _planeLineEnd;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class OSGMANIPULATOR_EXPORT RotateCylinderDragger : public Dragger
|
||||
|
||||
osg::ref_ptr<CylinderPlaneProjector> _projector;
|
||||
|
||||
osg::Vec3 _prevWorldProjPt;
|
||||
osg::Vec3d _prevWorldProjPt;
|
||||
bool _prevPtOnCylinder;
|
||||
osg::Matrix _startLocalToWorld, _startWorldToLocal;
|
||||
osg::Quat _prevRotation;
|
||||
|
||||
@@ -55,7 +55,7 @@ class OSGMANIPULATOR_EXPORT RotateSphereDragger : public Dragger
|
||||
|
||||
osg::ref_ptr<SpherePlaneProjector> _projector;
|
||||
|
||||
osg::Vec3 _prevWorldProjPt;
|
||||
osg::Vec3d _prevWorldProjPt;
|
||||
bool _prevPtOnSphere;
|
||||
osg::Matrix _startLocalToWorld, _startWorldToLocal;
|
||||
osg::Quat _prevRotation;
|
||||
|
||||
@@ -44,8 +44,8 @@ class OSGMANIPULATOR_EXPORT Scale1DDragger : public Dragger
|
||||
void setupDefaultGeometry();
|
||||
|
||||
/** Set/Get min scale for dragger. */
|
||||
inline void setMinScale(float min) { _minScale = min; }
|
||||
inline float getMinScale() const { return _minScale; }
|
||||
inline void setMinScale(double min) { _minScale = min; }
|
||||
inline double getMinScale() const { return _minScale; }
|
||||
|
||||
/** Set/Get color for dragger. */
|
||||
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
|
||||
@@ -66,19 +66,19 @@ class OSGMANIPULATOR_EXPORT Scale1DDragger : public Dragger
|
||||
inline osg::Node* getRightHandleNode() { return _rightHandleNode.get(); }
|
||||
|
||||
/** Set left/right handle position. */
|
||||
inline void setLeftHandlePosition(float pos) { _projector->getLineStart() = osg::Vec3(pos,0.0,0.0); }
|
||||
inline float getLeftHandlePosition() const { return _projector->getLineStart()[0]; }
|
||||
inline void setRightHandlePosition(float pos) { _projector->getLineEnd() = osg::Vec3(pos,0.0,0.0); }
|
||||
inline float getRightHandlePosition() { return _projector->getLineEnd()[0]; }
|
||||
inline void setLeftHandlePosition(double pos) { _projector->getLineStart() = osg::Vec3d(pos,0.0,0.0); }
|
||||
inline double getLeftHandlePosition() const { return _projector->getLineStart()[0]; }
|
||||
inline void setRightHandlePosition(double pos) { _projector->getLineEnd() = osg::Vec3d(pos,0.0,0.0); }
|
||||
inline double getRightHandlePosition() { return _projector->getLineEnd()[0]; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Scale1DDragger();
|
||||
|
||||
osg::ref_ptr< LineProjector > _projector;
|
||||
osg::Vec3 _startProjectedPoint;
|
||||
float _scaleCenter;
|
||||
float _minScale;
|
||||
osg::Vec3d _startProjectedPoint;
|
||||
double _scaleCenter;
|
||||
double _minScale;
|
||||
|
||||
osg::ref_ptr< osg::Node > _leftHandleNode;
|
||||
osg::ref_ptr< osg::Node > _rightHandleNode;
|
||||
|
||||
@@ -44,8 +44,8 @@ class OSGMANIPULATOR_EXPORT Scale2DDragger : public Dragger
|
||||
void setupDefaultGeometry();
|
||||
|
||||
/** Set/Get min scale for dragger. */
|
||||
inline void setMinScale(const osg::Vec2& min) { _minScale = min; }
|
||||
inline const osg::Vec2& getMinScale() const { return _minScale; }
|
||||
inline void setMinScale(const osg::Vec2d& min) { _minScale = min; }
|
||||
inline const osg::Vec2d& getMinScale() const { return _minScale; }
|
||||
|
||||
/** Set/Get color for dragger. */
|
||||
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
|
||||
@@ -70,34 +70,34 @@ class OSGMANIPULATOR_EXPORT Scale2DDragger : public Dragger
|
||||
inline osg::Node* getBottomRightHandleNode() { return _bottomRightHandleNode.get(); }
|
||||
|
||||
/** Set/Get the handle nodes postion for dragger. */
|
||||
inline void setTopLeftHandlePosition(const osg::Vec2& pos) { _topLeftHandlePosition = pos; }
|
||||
const osg::Vec2& getTopLeftHandlePosition() { return _topLeftHandlePosition; }
|
||||
inline void setBottomLeftHandlePosition(const osg::Vec2& pos) { _bottomLeftHandlePosition = pos; }
|
||||
const osg::Vec2& getBottomLeftHandlePosition() { return _bottomLeftHandlePosition; }
|
||||
inline void setTopRightHandlePosition(const osg::Vec2& pos) { _topRightHandlePosition = pos; }
|
||||
const osg::Vec2& getTopRightHandlePosition() { return _topRightHandlePosition; }
|
||||
inline void setBottomRightHandlePosition(const osg::Vec2& pos){ _bottomRightHandlePosition = pos; }
|
||||
const osg::Vec2& getBottomRightHandlePosition() { return _bottomRightHandlePosition; }
|
||||
inline void setTopLeftHandlePosition(const osg::Vec2d& pos) { _topLeftHandlePosition = pos; }
|
||||
const osg::Vec2d& getTopLeftHandlePosition() { return _topLeftHandlePosition; }
|
||||
inline void setBottomLeftHandlePosition(const osg::Vec2d& pos) { _bottomLeftHandlePosition = pos; }
|
||||
const osg::Vec2d& getBottomLeftHandlePosition() { return _bottomLeftHandlePosition; }
|
||||
inline void setTopRightHandlePosition(const osg::Vec2d& pos) { _topRightHandlePosition = pos; }
|
||||
const osg::Vec2d& getTopRightHandlePosition() { return _topRightHandlePosition; }
|
||||
inline void setBottomRightHandlePosition(const osg::Vec2d& pos){ _bottomRightHandlePosition = pos; }
|
||||
const osg::Vec2d& getBottomRightHandlePosition() { return _bottomRightHandlePosition; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Scale2DDragger();
|
||||
|
||||
osg::ref_ptr< PlaneProjector > _projector;
|
||||
osg::Vec3 _startProjectedPoint;
|
||||
osg::Vec2 _scaleCenter;
|
||||
osg::Vec2 _referencePoint;
|
||||
osg::Vec2 _minScale;
|
||||
osg::Vec3d _startProjectedPoint;
|
||||
osg::Vec2d _scaleCenter;
|
||||
osg::Vec2d _referencePoint;
|
||||
osg::Vec2d _minScale;
|
||||
|
||||
osg::ref_ptr< osg::Node > _topLeftHandleNode;
|
||||
osg::ref_ptr< osg::Node > _bottomLeftHandleNode;
|
||||
osg::ref_ptr< osg::Node > _topRightHandleNode;
|
||||
osg::ref_ptr< osg::Node > _bottomRightHandleNode;
|
||||
|
||||
osg::Vec2 _topLeftHandlePosition;
|
||||
osg::Vec2 _bottomLeftHandlePosition;
|
||||
osg::Vec2 _topRightHandlePosition;
|
||||
osg::Vec2 _bottomRightHandlePosition;
|
||||
osg::Vec2d _topLeftHandlePosition;
|
||||
osg::Vec2d _bottomLeftHandlePosition;
|
||||
osg::Vec2d _topRightHandlePosition;
|
||||
osg::Vec2d _bottomRightHandlePosition;
|
||||
|
||||
osg::Vec4 _color;
|
||||
osg::Vec4 _pickColor;
|
||||
|
||||
@@ -30,7 +30,7 @@ class OSGMANIPULATOR_EXPORT Translate1DDragger : public Dragger
|
||||
|
||||
Translate1DDragger();
|
||||
|
||||
Translate1DDragger(const osg::Vec3& s, const osg::Vec3& e);
|
||||
Translate1DDragger(const osg::Vec3d& s, const osg::Vec3d& e);
|
||||
|
||||
/** Handle pick events on dragger and generate TranslateInLine commands. */
|
||||
virtual bool handle(const PointerInfo& pi, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
|
||||
@@ -54,7 +54,7 @@ class OSGMANIPULATOR_EXPORT Translate1DDragger : public Dragger
|
||||
virtual ~Translate1DDragger();
|
||||
|
||||
osg::ref_ptr< LineProjector > _projector;
|
||||
osg::Vec3 _startProjectedPoint;
|
||||
osg::Vec3d _startProjectedPoint;
|
||||
|
||||
osg::Vec4 _color;
|
||||
osg::Vec4 _pickColor;
|
||||
|
||||
@@ -53,7 +53,7 @@ class OSGMANIPULATOR_EXPORT Translate2DDragger : public Dragger
|
||||
virtual ~Translate2DDragger();
|
||||
|
||||
osg::ref_ptr< PlaneProjector > _projector;
|
||||
osg::Vec3 _startProjectedPoint;
|
||||
osg::Vec3d _startProjectedPoint;
|
||||
|
||||
osg::Vec4 _color;
|
||||
osg::Vec4 _pickColor;
|
||||
|
||||
Reference in New Issue
Block a user