[osg-users] Fwd: Fwd: CallBack issue

ami guru dosto.walla at gmail.com
Sat Mar 28 04:00:06 PDT 2009


Hello ulrich,


The following snippet may elaborate more:



******************************'
  //SET  THE data variance to dynamic to let OSG know that
  //we shall modify this node during update traversal
  mtLeft->setDataVariance(osg::Object::DYNAMIC);

  //set the update callback
  mtLeft->setUpdateCallback(new RotateCB);

  osg::Matrix m;
  m.makeTranslate(-6.0f,0.0f,0.0f);
  mtLeft->setMatrix(m);
  mtLeft->addChild(cow.get());


*****************************'


On the above snippet we have made a translation after the callback. And that
one is appended to the one that has been called inside the RotateCB.


The code snippet has been taken from the starter guide.


Regards
Sajjad

---------- Forwarded message ----------
From: Ulrich Hertlein <u.hertlein at sandbox.de>
Date: Sat, Mar 28, 2009 at 5:04 AM
Subject: Re: [osg-users] Fwd: CallBack issue
To: OpenSceneGraph Users <osg-users at lists.openscenegraph.org>


Hi Sajjad,

On 28/3/09 12:01 PM, ami guru wrote:

> With callbacks we dynamically modify the node during the update
> traversal.So any node that has already gone through some affine
> transformation will be replaced in the call backs, but not concatenated.
>
> On  the other hand if we specify any affine trnasformation after calling
> the callback, the last transformation will be concatenated to the one
> that have been assigned durng callbacks.
>
> And that happens to any type of dynamic transformation , not only with
> the affine one.
>

I'm not quite sure I follow you.  What you're describing has nothing to do
with the update traversal as such.

You're setting the transformation matrix of a certain node.  Naturally this
overwrites whatever was set before.

If you need a certain transformation (e.g. a scale) to be preserved then
either put it in a parent or child MatrixTransform or include it in the
calculated matrix.  Or decompose the existing matrix and re-assemble it with
the modified values.


Cheers,
/ulrich
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090328/0ab6f712/attachment-0003.htm>


More information about the osg-users mailing list