[osg-users] Possible Bug in osg::AutoTransform
Cysneros, Nelson SPAWAR
nelson.cysneros at navy.mil
Tue Jul 24 15:40:36 PDT 2007
Thanks Peter,
What version of OSG are you using?
Regards
-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Peter
Gebauer
Sent: Tuesday, July 24, 2007 11:09 AM
To: osg-users at lists.openscenegraph.org; robert at openscenegraph.com
Subject: Re: [osg-users] Possible Bug in osg::AutoTransform
Hi!
I've been experimenting with transformations, what happens that the
AutoTransform updates using automatic scaling to the screen. You can set
auto scale to false using setAutoScaleToScreen(bool) and set your scale
manually using setScale(const Vec3f&).
If you still want auto scaling enabled that can be done too by using
a PositionAttitudeTransform as a child of AutoTransform.
It works as one would suspect, you just have to compensate for any
previous,
automatic scaling.
/Peter
On 2007-07-24 (Tue) 10:25, Cysneros, Nelson SPAWAR wrote:
> 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.
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.
> org
>
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g
More information about the osg-users
mailing list