[osg-users] AutoTransform for scale 3.6.0

Brad Colbert bcolbert at rscusa.com
Mon Jun 18 10:06:38 PDT 2018


Hi Folks,

I have an AutoTransform set to maintain the axes model to the same screen
size but I'm guessing I'm using it incorrectly.  It behaves just like a
scale node with a constant fixed scale instead of changing the scale to
maintain a constant screen size.  I've tried all sorts of param's for
Min/Max scale.  Code snip:

            // Load an example model to show the XYZ axes.
            // in (m), hence the MatrixTransform.
            std::string modelFilename =
                std::string(getenv("APP_SIM_DATA_PATH")) +
"/models/axes.osgt";
            osg::ref_ptr<osg::Node> loadedModel =
osgDB::readRefNodeFile(modelFilename);
            if (APP_VERIFY(nullptr != loadedModel.get()))
            {
              // Add an autotransform to make the axes the same size on the
screen.
              osg::ref_ptr<osg::AutoTransform> at = new osg::AutoTransform;
              at->addChild(loadedModel);
              at->setAutoScaleToScreen(true);
              at->setMinimumScale(0.1);
              at->setMaximumScale(10.0);

              // Add the model
              scene_->addChild(at);
            } // if loadedModel
            else {
              APP_LOG_ERROR(
                  "App::DidInitialize: Model not loaded %s",
                  modelFilename.c_str());
            }

Thoughts?

-Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180618/71cf97eb/attachment.html>


More information about the osg-users mailing list