|
int main(int argc,char**argv )
{
osgViewer::Viewer viewer;
osg::ref_ptr<osg::Node> Model= osgDB::readNodeFile("Tile_+002_+000.osgb");
const osg::ref_ptr<osg::Group> root=new osg::Group();
Model->getOrCreateStateSet()->setMode (GL_NORMALIZE,osg::StateAttribute::ON);
osg::ref_ptr<osg::MatrixTransform> selection=new osg::MatrixTransform;
selection->addChild (Model);
float scale=Model->getBound ().radius() *1.3;
osgManipulator::ScaleAxisDragger *sad=new osgManipulator::ScaleAxisDragger();
sad->setupDefaultGeometry();
sad->setMatrix (osg::Matrix::scale(scale,scale,scale)*osg::Matrix ::translate(Model->getBound().center()));
sad->addTransformUpdating (selection);
sad->setHandleEvents (true);
sad->setActivationKeyEvent (osgGA::GUIEventAdapter::MODKEY_CTRL);
root->addChild (selection);
root->addChild(sad);
viewer.setSceneData(root.get());
viewer.realize();
viewer.run(); |
|