From Andreas Henne, "in my application I use the TrackballDragger, the ScaleAxisDragger and the TranslateAxisDragger. Unfortunately these draggers are very thin and they do not provide methods to change their visual appearance. Another problem that I noticed is that lighting on the cones and boxes of the TranslateAxisDragger and ScaleAxisDragger is incorrect when the draggers are scaled due to not normalized normals. This small patch adresses these problems, providing methods to make the draggers thicker. I have attached a zip archive containing the corresponding files and also a modified osgManipulator example that makes use of the modifications. I don't want to retain any copyright."
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
#define OSGMANIPULATOR_SCALEAXISDRAGGER 1
|
||||
|
||||
#include <osgManipulator/Scale1DDragger>
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/LineWidth>
|
||||
|
||||
namespace osgManipulator {
|
||||
|
||||
@@ -33,6 +36,18 @@ class OSGMANIPULATOR_EXPORT ScaleAxisDragger : public CompositeDragger
|
||||
/** Setup default geometry for dragger. */
|
||||
void setupDefaultGeometry();
|
||||
|
||||
/** Sets the width of the axis lines in pixels. */
|
||||
void setAxisLineWidth(float linePixelWidth);
|
||||
|
||||
/** Retrieves the width of the axis lines in pixels. */
|
||||
float getAxisLineWidth() const { return _axisLineWidth; }
|
||||
|
||||
/** Sets the size of the boxes. */
|
||||
void setBoxSize(float size);
|
||||
|
||||
/** Retrieves the size of the boxes. */
|
||||
float getBoxSize() const { return _boxSize; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~ScaleAxisDragger();
|
||||
@@ -40,6 +55,13 @@ class OSGMANIPULATOR_EXPORT ScaleAxisDragger : public CompositeDragger
|
||||
osg::ref_ptr< Scale1DDragger > _xDragger;
|
||||
osg::ref_ptr< Scale1DDragger > _yDragger;
|
||||
osg::ref_ptr< Scale1DDragger > _zDragger;
|
||||
|
||||
float _boxSize;
|
||||
float _axisLineWidth;
|
||||
|
||||
osg::ref_ptr<osg::Geode> _lineGeode;
|
||||
osg::ref_ptr<osg::LineWidth> _lineWidth;
|
||||
osg::ref_ptr<osg::Box> _box;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
|
||||
#include <osgManipulator/RotateCylinderDragger>
|
||||
#include <osgManipulator/RotateSphereDragger>
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/LineWidth>
|
||||
|
||||
namespace osgManipulator {
|
||||
|
||||
@@ -34,6 +37,18 @@ class OSGMANIPULATOR_EXPORT TrackballDragger : public CompositeDragger
|
||||
/** Setup default geometry for dragger. */
|
||||
void setupDefaultGeometry();
|
||||
|
||||
/** Sets the width of the axis lines in pixels. */
|
||||
void setAxisLineWidth(float linePixelWidth);
|
||||
|
||||
/** Retrieves the width of the axis lines in pixels. */
|
||||
float getAxisLineWidth() const { return _axisLineWidth; }
|
||||
|
||||
/** Sets the height of the cylinders representing the axis lines for picking. */
|
||||
void setPickCylinderHeight(float pickCylinderHeight);
|
||||
|
||||
/** Retrieves the height of the cylinders representing the axis lines for picking. */
|
||||
float getPickCylinderHeight() const { return _pickCylinderHeight; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~TrackballDragger();
|
||||
@@ -42,6 +57,13 @@ class OSGMANIPULATOR_EXPORT TrackballDragger : public CompositeDragger
|
||||
osg::ref_ptr<RotateCylinderDragger> _yDragger;
|
||||
osg::ref_ptr<RotateCylinderDragger> _zDragger;
|
||||
osg::ref_ptr<RotateSphereDragger> _xyzDragger;
|
||||
|
||||
float _axisLineWidth;
|
||||
float _pickCylinderHeight;
|
||||
|
||||
osg::ref_ptr<osg::Geode> _geode;
|
||||
osg::ref_ptr<osg::Cylinder> _cylinder;
|
||||
osg::ref_ptr<osg::LineWidth> _lineWidth;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
#define OSGMANIPULATOR_TRANSLATEAXISDRAGGER 1
|
||||
|
||||
#include <osgManipulator/Translate1DDragger>
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/LineWidth>
|
||||
|
||||
namespace osgManipulator {
|
||||
|
||||
@@ -33,6 +36,24 @@ class OSGMANIPULATOR_EXPORT TranslateAxisDragger : public CompositeDragger
|
||||
/** Setup default geometry for dragger. */
|
||||
void setupDefaultGeometry();
|
||||
|
||||
/** Sets the width of the axis lines in pixels. */
|
||||
void setAxisLineWidth(float linePixelWidth);
|
||||
|
||||
/** Retrieves the width of the axis lines in pixels. */
|
||||
float getAxisLineWidth() const { return _axisLineWidth; }
|
||||
|
||||
/** Sets the radius of the cylinders representing the axis lines for picking. */
|
||||
void setPickCylinderRadius(float pickCylinderRadius);
|
||||
|
||||
/** Retrieves the radius of the cylinders representing the axis lines for picking. */
|
||||
float getPickCylinderRadius() const { return _pickCylinderRadius; }
|
||||
|
||||
/** Sets the height of the cones. */
|
||||
void setConeHeight(float radius);
|
||||
|
||||
/** Retrieves the height of the cones. */
|
||||
float getConeHeight() const { return _coneHeight; }
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~TranslateAxisDragger();
|
||||
@@ -40,6 +61,15 @@ class OSGMANIPULATOR_EXPORT TranslateAxisDragger : public CompositeDragger
|
||||
osg::ref_ptr< Translate1DDragger > _xDragger;
|
||||
osg::ref_ptr< Translate1DDragger > _yDragger;
|
||||
osg::ref_ptr< Translate1DDragger > _zDragger;
|
||||
|
||||
float _coneHeight;
|
||||
float _axisLineWidth;
|
||||
float _pickCylinderRadius;
|
||||
|
||||
osg::ref_ptr<osg::Geode> _lineGeode;
|
||||
osg::ref_ptr<osg::Cylinder> _cylinder;
|
||||
osg::ref_ptr<osg::LineWidth> _lineWidth;
|
||||
osg::ref_ptr<osg::Cone> _cone;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user