[osg-users] Fwd: CallBack issue

2009-03-27 Thread ami guru
Thanks Paul and Ulrich


It works fine now.

I have some issue to discuss about Callbacks


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.


Please correct me if i misunderstood the concept.



Regards
Sajjad

-- Forwarded message --
From: Ulrich Hertlein u.hertl...@sandbox.de
Date: Sat, Mar 28, 2009 at 12:24 AM
Subject: Re: [osg-users] CallBack issue
To: OpenSceneGraph Users osg-users@lists.openscenegraph.org


Hello Ami,

On 28/3/09 8:50 AM, ami guru wrote:

   virtual void operator()(osg::Node *node,
   osg::NodeVisitor *nv)
   {
  osg::Matrix mR;
 mR.makeRotate(m_angle, osg::Vec3(0.0f,0.0f,1.0f));

 mtLeft-setMatrix(mR);
 ...

   osg::Vec3f teapotTransVec = osg::Vec3f(5,2,-12);
   osg::Vec3f teapotScaleVec = osg::Vec3f(20.1f,20.1f,20.1f);
   teapotTransMat.makeTranslate(teapotTransVec);
   teapotScaleMat.makeScale(teapotScaleVec);

   teapotPos-setMatrix(teapotTransMat * teapotScaleMat);


You're originally including a scaling transform in the Matrix.
The Callback operator replaces this with only a rotation matrix i.e. the
scaling part is lost hence the object looks smaller.

Cheers,
/ulrich
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Fwd: CallBack issue

2009-03-27 Thread Ulrich Hertlein

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@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org