Re: [osg-users] "hooking" into the Trackballmanipulator transform

2018-05-08 Thread Andrew Cunningham
Yup you are right, that works great!

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73570#73570





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


Re: [osg-users] "hooking" into the Trackballmanipulator transform

2018-05-08 Thread Julien Valentin
Hi
Indeed derivation is the answer and overriding

Code:
virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& 
us );


should be sufficient

Cheers


loopy wrote:
> Hi,
> I need to "hook" into the TrackballManipulator to provide feedback to the 
> user. As the user rotates the model, I want to get the matrix and extract 
> Euler angles.
> I'm stuck at how to get notified when the when the view matrix changes. 
> Should I derive a new class from TrackballManipulator ?
> 
> OSG 3.4.1 
> Thanks
> Andrew



Twirling twirling twirling toward freedom

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73569#73569





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


[osg-users] Trackball Manipulation Broken?

2018-05-08 Thread Erik Hensens
Hi everyone!

My app allows manipulating the scene via the osgGA::TrackballManipulator. 
Without changing any of the app code, we upgraded from OSG 3.2.0.99 to 
3.2.1.100 and now the trackball manipulation doesn't work.

I don't know how to check whether or not this is a known bug so I figured I'd 
ask on the forums. Does anyone know what's up?

Thank you very much!

Cheers,
Erik

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73568#73568





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


[osg-users] "hooking" into the Trackballmanipulator transform

2018-05-08 Thread Andrew Cunningham
Hi,
I need to "hook" into the TrackballManipulator to provide feedback to the user. 
As the user rotates the model, I want to get the matrix and extract Euler 
angles.
I'm stuck at how to get notified when the when the view matrix changes. Should 
I derive a new class from TrackballManipulator ?

OSG 3.4.1 
Thanks
Andrew

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73567#73567





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


Re: [osg-users] EXTERNAL: Re: Getting the combined matrix from a Node?

2018-05-08 Thread Rowley, Marlin R
Yes, I used this way.

Thanks,

-M


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf 
Of Robert Osfield
Sent: Tuesday, May 8, 2018 2:24 AM
To: OpenSceneGraph Users 
Subject: EXTERNAL: Re: [osg-users] Getting the combined matrix from a Node?

Hi Marlin,
The Transform class and it's subclasses are designed to be used as part of 
scene graph, this allow Transform subclasses that are absolute (ignore 
transforms+camera matrices above them) or relative (multiple the inherited 
modelview matrix) to enable this in a generic way the Transform class has two 
helper methods Transform::computeLocalToWorld(osg::Matrix& matrix, NodeVistor*) 
and computeWorldToLocal(osg::Matrix& matrix, NodeVisior*). Only some Transform 
implementations need to check the NodeVisitor for extra data, most will just 
ignore that parameter and just do the matrix maths required.
The computeLocalToWorld() method returns a bool on success, and you pass in the 
matrix you want to apply,  You're code segment appears to confuse things in 
this regard.

If you want to transform of any node in the scene graph you can do 
Node::getWorldMatrices(), this finds all the parental NodePaths of that node 
and then returns a vector containing a matrix for each NodePath found.
Robert.


On 7 May 2018 at 19:58, Rowley, Marlin R 
> wrote:
Hello,

I’m trying to figure out how to retrieve the combined matrix from a node that 
is of a PositionAttitudeTransform node type.  I can get it converted to a 
Transform() class, but there is no clear way of getting the combined matrix 
from local to world.  For example,

Osg::PositionAttitudeTransform trans;
Trans.setScale(2,2,2);
Trans.setPosition(0,10,0);

Osg::Matrixd temp = getCombinedTransform(trans);
Osg::Matrixd getCombinedTransform(const osg::ref_ptr & mat)
{
  Auto m = mat->asTransform();
  Return m->computeLocalToWorldMatrix (m, ???); << == why use a 
node visitor on yourself?

  Or

  Return m->getCombinedMatrix()?? <<  = is there such a thing?
}


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com


___
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] Getting the combined matrix from a Node?

2018-05-08 Thread Robert Osfield
Hi Marlin,

The Transform class and it's subclasses are designed to be used as part of
scene graph, this allow Transform subclasses that are absolute (ignore
transforms+camera matrices above them) or relative (multiple the inherited
modelview matrix) to enable this in a generic way the Transform class has
two helper methods Transform::computeLocalToWorld(osg::Matrix& matrix,
NodeVistor*) and computeWorldToLocal(osg::Matrix& matrix, NodeVisior*).
Only some Transform implementations need to check the NodeVisitor for extra
data, most will just ignore that parameter and just do the matrix maths
required.

The computeLocalToWorld() method returns a bool on success, and you pass in
the matrix you want to apply,  You're code segment appears to confuse
things in this regard.


If you want to transform of any node in the scene graph you can do
Node::getWorldMatrices(), this finds all the parental NodePaths of that
node and then returns a vector containing a matrix for each NodePath
found.

Robert.



On 7 May 2018 at 19:58, Rowley, Marlin R  wrote:

> Hello,
>
>
>
> I’m trying to figure out how to retrieve the combined matrix from a node
> that is of a PositionAttitudeTransform node type.  I can get it converted
> to a Transform() class, but there is no clear way of getting the combined
> matrix from local to world.  For example,
>
>
>
> Osg::PositionAttitudeTransform trans;
>
> Trans.setScale(2,2,2);
>
> Trans.setPosition(0,10,0);
>
>
>
> Osg::Matrixd temp = getCombinedTransform(trans);
>
> Osg::Matrixd getCombinedTransform(const osg::ref_ptr & mat)
>
> {
>
>   Auto m = mat->asTransform();
>
>   Return m->computeLocalToWorldMatrix (m, ???); << == why
> use a node visitor on yourself?
>
>
>
>   Or
>
>
>
>   Return m->getCombinedMatrix()?? <<  = is there such a
> thing?
>
> }
>
>
>
> 
>
> Marlin Rowley
>
> Software Engineer, Staff
>
> [image: cid:image002.jpg@01D39374.DEC5A2E0]
>
> *Missiles and Fire Control*
>
> 972-603-1931 (office)
>
> 214-926-0622 (mobile)
>
> marlin.r.row...@lmco.com
>
>
>
> ___
> 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] Getting the combined matrix from a Node?

2018-05-08 Thread Sebastian Messerschmidt


Hi Marlin,

you need to get the appropriate parent-node paths:

osg::NodePathList parent_node_list = mat.getParentalNodePaths();
Now if you know the path you want to retrieve, you can call
e.g.:
node_path = parent_node_list[1];

osg::Matrix mat = osg::computeLocalToWorld(node_path);

Also the getParentalNodePaths() function lets you specify the node in 
the parent path where to stop traversal (e.g. to get transformations in 
a local model reference-frame)


The reason is, that the scene-graph is a DAG where nodes can have 
multiple parents.
Another possibility is to use the per-instance transform inside an 
update callback:


void MyUpdateCallback::operator()( osg::Node* node, osg::NodeVisitor* nv)
{
osg::NodePath& node_path = nv->getNodePath() ;
osg::Matrix mat = osg::computeLocalToWorld(node_path);
///...
traverse(node,nv);
}



Cheers
Sebastian


Am 07.05.2018 um 20:58 schrieb Rowley, Marlin R:

Hello,

I’m trying to figure out how to retrieve the combined matrix from a node 
that is of a PositionAttitudeTransform node type.  I can get it 
converted to a Transform() class, but there is no clear way of getting 
the combined matrix from local to world.  For example,


Osg::PositionAttitudeTransform trans;

Trans.setScale(2,2,2);

Trans.setPosition(0,10,0);

Osg::Matrixd temp = getCombinedTransform(trans);

Osg::Matrixd getCombinedTransform(const osg::ref_ptr & mat)

{

   Auto m = mat->asTransform();

   Return m->computeLocalToWorldMatrix (m, ???); << == 
why use a node visitor on yourself?


   Or

   Return m->getCombinedMatrix()?? <<  = is there such a 
thing?


}



Marlin Rowley

Software Engineer, Staff

cid:image002.jpg@01D39374.DEC5A2E0

/Missiles and Fire Control/

972-603-1931 (office)

214-926-0622 (mobile)

marlin.r.row...@lmco.com 



___
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