Re: [osg-users] LineOfSight intersection returning geometry
HI Tony, On 16 February 2016 at 05:00, Tony Vasilewrote: > By the way does OpenSceneGraph have a separate mask for intersection as well > as rendering? I have some geometry that I don't want to intersect but do want > to be rendered. The NodeVisitor base class has a setTraversalMask() method for controlling which mask to && against node mask's with. This means the osgUtil::IntersectionVisitor class inherits this setTraversalMask(). The View::computrIntersection(..) convenience methods all take a traversalMask that they pass on to the IntersectionVisitor. i.e. View:bool computeIntersections(float x,float y, osgUtil::LineSegmentIntersector::Intersections& intersections,osg::Node::NodeMask traversalMask = 0x); Robert. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineOfSight intersection returning geometry
Thanks for the info. By the way does OpenSceneGraph have a separate mask for intersection as well as rendering? I have some geometry that I don't want to intersect but do want to be rendered. Tony V -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=66297#66297 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineOfSight intersection returning geometry
Hi Tony, You only need to set the mask on node at the top of the subgraph for the whole subgraph to be culled from a traversal. Robert. On 4 February 2016 at 00:43, Tony Vasilewrote: > So if you have a large piece of geometry like terrain or ocean is simply a > case of setting the right mask on the root node of this large geometry to > avoid or allow intersections? Or do you have set the mask on all the pieces > of said large geometry? > > > Tony V > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=66187#66187 > > > > > > ___ > 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] LineOfSight intersection returning geometry
So if you have a large piece of geometry like terrain or ocean is simply a case of setting the right mask on the root node of this large geometry to avoid or allow intersections? Or do you have set the mask on all the pieces of said large geometry? Tony V -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=66187#66187 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineOfSight intersection returning geometry
Hi Tony, On 22 January 2016 at 02:31, Tony Vasilewrote: > By the way what are the following fields in > osgUtil::LineSegmentIntersector::Intersection : > > double ratio; > osg::NodePath nodePath; > osg::ref_ptr drawable; > osg::ref_ptrmatrix; > osg::Vec3d localIntersectionPoint; > osg::Vec3 localIntersectionNormal; > IndexList indexList; > RatioList ratioList; > unsigned intprimitiveIndex; > > Things like the nodePath, drawable, localIntersectionPoint, and the > localIntersectionNormal, I can work out what the are. But what are the ratio, > ratioList, primitiveIndex, and the matrix? Is the matrix a transformation > matrix? The IndexList contains the list of vertex indices of the primitive that has been intersected, and the RatioList contains the weighting of those vertices which when added together with their ratios gives the intersection point. This allows you to compute things like texture coordinates, colours etc. The primitiveIndex is the primitive number into the geometry that the intersected primitive lies. The matrix is the accumulated transformation matrix that takes the local coordinate point into coordinate frame of the root of the intersection traversal. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineOfSight intersection returning geometry
Hi Tony, The TraversalMask is part of the osg::NodeVisitor base class, so simply do: intersectionVisitor.setTraversalMask(0x01); Cheers, Robert. On 21 January 2016 at 07:57, Tony Vasilewrote: > Okay so I found this code: > > > Code: > > osg::ref_ptr intersectorGroup = new > osgUtil::IntersectorGroup(); > > for(unsigned int r=0; r { > for(unsigned int c=0; c { > osg::Vec3d s = start + deltaColumn * double(c) + deltaRow * > double(r); > osg::Vec3d e = end + deltaColumn * double(c) + deltaRow * > double(r); > osg::ref_ptr intersector = > new osgUtil::LineSegmentIntersector(s, e); > intersectorGroup->addIntersector( intersector.get() ); > } > } > > > osgUtil::IntersectionVisitor intersectVisitor( > intersectorGroup.get(), new MyReadCallback ); > scene->accept(intersectVisitor); > > > in the osgintersections.cpp example. One thing that I can't find is how do I > set a traversal mask? > > Tony > > > Tony V > > -- > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=66069#66069 > > > > > > ___ > 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] LineOfSight intersection returning geometry
Thanks for that. I found my answer about an hour after posting this one. By the way what are the following fields in osgUtil::LineSegmentIntersector::Intersection : double ratio; osg::NodePath nodePath; osg::ref_ptr drawable; osg::ref_ptrmatrix; osg::Vec3d localIntersectionPoint; osg::Vec3 localIntersectionNormal; IndexList indexList; RatioList ratioList; unsigned intprimitiveIndex; Things like the nodePath, drawable, localIntersectionPoint, and the localIntersectionNormal, I can work out what the are. But what are the ratio, ratioList, primitiveIndex, and the matrix? Is the matrix a transformation matrix? Tony V -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=66086#66086 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineOfSight intersection returning geometry
Okay so I found this code: Code: osg::ref_ptr intersectorGroup = new osgUtil::IntersectorGroup(); for(unsigned int r=0; raddIntersector( intersector.get() ); } } osgUtil::IntersectionVisitor intersectVisitor( intersectorGroup.get(), new MyReadCallback ); scene->accept(intersectVisitor); in the osgintersections.cpp example. One thing that I can't find is how do I set a traversal mask? Tony Tony V -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=66069#66069 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org