[osg-users] Possible Bug in osg::AutoTransform
Cysneros, Nelson SPAWAR
nelson.cysneros at navy.mil
Tue Jul 24 10:25:37 PDT 2007
Thank you Robert,
I think I'm unclear on how to scale the subgraph.
I tried adding a PositionAttitudeTransform object as a child of the
AutoTransform and scaling it. I also tried adding the AutoTransform as
a child to a PositionAttitudeTransform that is scaled. Neither seemed
to work. Am I doing something wrong?
My goal is to have my drawable object the same size no matter how much
you zoom in or out, but I need to control the initial size. Is their a
better way of doing this?
Code Snippets:
PositionAttitudeTransform object as a child of the AutoTransform
------------------------------------------------------------------
osg::Group* root = new osg::Group();
osg::Geode* geode = new osg::Geode();
//AutoTrans
osg::AutoTransform* at = new osg::AutoTransform;
at->setAutoScaleToScreen(true);
at->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);
//Initial Scale
osg::PositionAttitudeTransform* postrans = new
osg::PositionAttitudeTransform();
osg::Vec3 modelScale;
double value = 10000;
modelScale.set(value,value,value);
postrans->setScale( modelScale );
geode->addDrawable(new Symbol(getEntityTD()));
postrans->addChild(geode);
at->addChild(postrans);
root->addChild(at);
return root;
AutoTransform as a child to a PositionAttitudeTransform
------------------------------------------------------------------
osg::Group* root = new osg::Group();
osg::Geode* geode = new osg::Geode();
//AutoTrans
osg::AutoTransform* at = new osg::AutoTransform;
at->setAutoScaleToScreen(true);
at->setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN);
geode->addDrawable(new Symbol(getEntityTD()));
at->addChild(geode);
//Initial Scale
osg::PositionAttitudeTransform* postrans = new
osg::PositionAttitudeTransform();
osg::Vec3 modelScale;
double value = 10000;
modelScale.set(value,value,value);
postrans->setScale( modelScale );
postrans->addChild(at);
root->addChild(postrans);
return root;
-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Robert
Osfield
Sent: Tuesday, July 24, 2007 1:16 AM
To: osg-users at lists.openscenegraph.org
Subject: Re: [osg-users] Possible Bug in osg::AutoTransform
Hi Nelson,
This isn't a bug, when you do scale to screen what it does it uses puts
the subgraph into screen space by adjusting the scale parameter to fit.
If you want to change the scale of the subgraph then it'll need to built
with screen space coords in mind.
Robert.
More information about the osg-users
mailing list