Show
Ignore:
Timestamp:
12/24/14 12:56:48 (16 hours ago)
Author:
robert
Message:

Updated ChangeLog? and AUTHORS

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgManipulator/ScaleAxisDragger.cpp

    r13041 r13855  
    3636    addDragger(_zDragger.get()); 
    3737 
     38    _axisLineWidth = 2.0f; 
     39    _boxSize = 0.05f; 
     40 
    3841    setParentDragger(getParentDragger()); 
    3942} 
     
    4649{ 
    4750    // Create a line. 
    48     osg::Geode* lineGeode = new osg::Geode; 
     51    _lineGeode = new osg::Geode; 
    4952    { 
    5053        osg::Geometry* geometry = new osg::Geometry(); 
     
    5760        geometry->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,2)); 
    5861 
    59         lineGeode->addDrawable(geometry); 
     62        _lineGeode->addDrawable(geometry); 
    6063    } 
    6164 
    6265    // Turn of lighting for line and set line width. 
    6366    { 
    64         osg::LineWidth* linewidth = new osg::LineWidth(); 
    65         linewidth->setWidth(2.0f); 
    66         lineGeode->getOrCreateStateSet()->setAttributeAndModes(linewidth, osg::StateAttribute::ON); 
    67         lineGeode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); 
     67        _lineWidth = new osg::LineWidth(); 
     68        _lineWidth->setWidth(_axisLineWidth); 
     69        _lineGeode->getOrCreateStateSet()->setAttributeAndModes(_lineWidth, osg::StateAttribute::ON); 
     70        _lineGeode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF); 
    6871    } 
    6972 
    7073    // Add line to all the individual 1D draggers. 
    71     _xDragger->addChild(lineGeode); 
    72     _yDragger->addChild(lineGeode); 
    73     _zDragger->addChild(lineGeode); 
     74    _xDragger->addChild(_lineGeode); 
     75    _yDragger->addChild(_lineGeode); 
     76    _zDragger->addChild(_lineGeode); 
    7477 
    7578    osg::Geode* geode = new osg::Geode; 
    7679 
    7780    // Create a box. 
    78     geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(1.0f,0.0f,0.0f), 0.05))); 
     81    _box = new osg::Box(osg::Vec3(1.0f,0.0f,0.0f), _boxSize); 
     82    geode->addDrawable(new osg::ShapeDrawable(_box)); 
     83 
     84    // This ensures correct lighting for scaled draggers. 
     85#if !defined(OSG_GLES2_AVAILABLE) 
     86    geode->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON); 
     87#endif 
    7988 
    8089    // Add geode to all 1D draggers. 
     
    100109    _zDragger->setColor(osg::Vec4(0.0f,0.0f,1.0f,1.0f)); 
    101110} 
     111 
     112void ScaleAxisDragger::setAxisLineWidth(float linePixelWidth) 
     113{ 
     114    _axisLineWidth = linePixelWidth; 
     115    if (_lineWidth.valid()) 
     116        _lineWidth->setWidth(linePixelWidth); 
     117} 
     118 
     119void ScaleAxisDragger::setBoxSize(float size) 
     120{ 
     121    _boxSize = size; 
     122    if (_box.valid()) 
     123        _box->setHalfLengths(osg::Vec3(size * 0.5f, size * 0.5f, size * 0.5f)); 
     124}