Hi,
you can see cooki3d c++
api<http://bertrand.greslier.free.fr/mamboV4.6/index.php?option=com_content&task=view&id=44&Itemid=53>class
EnvironnmentGeneric.cpp
function bool EnvironnementGeneric::computeIntersections(float x, float y,
osgUtil::IntersectVisitor::HitList& hitlist,
osg::Node::NodeMask mask)
it use file also the file PickIntersectVisitor.h
it is a an api very inspired from osgProducer and work with all GUI...
Regards,
Bertrand.
On 12/5/06, benny porat <[EMAIL PROTECTED]> wrote:
Hi,
I build an event handler for picking and everything work fine, we do
something like that
bool KEYBOARD_EVENT_HANDLER::handle(const osgGA::GUIEventAdapter&
ea,osgGA::GUIActionAdapter& aa)
{
switch(ea.getEventType())
{
case(osgGA::GUIEventAdapter::PUSH):
{
osgProducer::Viewer* viewer =
dynamic_cast<osgProducer::Viewer*>(&aa);
float x = ea.getX(); // x,y screen
float y = ea.getY();
osgUtil::IntersectVisitor::HitList benny;
if (viewer->computeIntersections(x,y,benny))
{
.
.
.
osg::Vec3 v1,v2;
viewer->computeNearFarPoints(x,y,0,v1,v2);
.
.
.
}
}
}
}
Now, I need to use GUI for my program so I use QT4, and I use Robert
example.
the problem is that the dynamic_cast return me NULL...
so I try to find intersection without the viewer, I study
osgUtil::IntersectVisitor, but there is a problem I don't know how to
convert me screen point(the one that I get from the osgGA::GUIEventAdapter).
another problem that I need to find the world coordinate of a given point
in the screen and a given z value until know I use the computeNearFarPoints
function to calculate it.
what I can do?
there is a way to work with viewer after all?
there is another way to find intersection?
there is replacement to those function that I can use?
thanks
NB
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
--
Bertrand Greslier
http://www.cooki3d.org
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/