From 9ac2c02dc2a3e1dd2a30015c91b4b9572801a312 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 13 Oct 2004 13:39:27 +0000 Subject: [PATCH] Increased the size of the inserted model so that it can be seen more easily, --- examples/osgsimulation/osgsimulation.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/examples/osgsimulation/osgsimulation.cpp b/examples/osgsimulation/osgsimulation.cpp index 59c86f023..d3ba8b083 100644 --- a/examples/osgsimulation/osgsimulation.cpp +++ b/examples/osgsimulation/osgsimulation.cpp @@ -90,12 +90,12 @@ public: ModelPositionCallback(): _latitude(0.0), _longitude(0.0), - _height(10000.0) + _height(100000.0) {} void updateParameters() { - _latitude -= ((2.0*osg::PI)/360.0)/100.0; + _latitude -= ((2.0*osg::PI)/360.0)/20.0; } @@ -192,7 +192,7 @@ int main(int argc, char **argv) viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS); viewer.getCullSettings().setComputeNearFarMode(osg::CullSettings::COMPUTE_NEAR_FAR_USING_PRIMITIVES); - viewer.getCullSettings().setNearFarRatio(0.0001f); + viewer.getCullSettings().setNearFarRatio(0.00001f); // get details on keyboard and mouse bindings used by the viewer. viewer.getUsage(*arguments.getApplicationUsage()); @@ -227,14 +227,21 @@ int main(int argc, char **argv) osg::Node* cessna = osgDB::readNodeFile("cessna.osg"); if (cessna) { + double s = 30000.0 / cessna->getBound().radius(); + + osg::MatrixTransform* scaler = new osg::MatrixTransform; + scaler->addChild(cessna); + scaler->setMatrix(osg::Matrixd::scale(s,s,s)); + scaler->getOrCreateStateSet()->setMode(GL_RESCALE_NORMAL,osg::StateAttribute::ON); + osg::MatrixTransform* mt = new osg::MatrixTransform; - mt->addChild(cessna); + mt->addChild(scaler); mt->setUpdateCallback(new ModelPositionCallback); csn->addChild(mt); osgGA::NodeTrackerManipulator* tm = new osgGA::NodeTrackerManipulator; - tm->setTrackNode(cessna); + tm->setTrackNode(scaler); unsigned int num = viewer.addCameraManipulator(tm); viewer.selectCameraManipulator(num);