[osg-users] RayIntersector with KdTree causes a crash

Ale Maro sasha71 at teletu.it
Wed Sep 5 06:51:37 PDT 2018


Hi Robert,

thanks for the update.
The issue with ShapeDrawable take us to the wrong way.

So at the end we find the cause of the problem is different.
I will describe it again:

1 - Take a geode (e.g. we loaded "cow.osg") and build a kdtree
2 - Make a clone with DEEP_COPY_ALL
3 - Applying LineSegmentIntersection to the clone we get the crash

If we clone with SHALLOW_COPY it works fine 

Attached is the modified osgPick example that reproduces the crash.
You just need to set the correct path to the file to be loaded and specify the --relative-camera-scene option as before

Here is an extract of the code. If you use a SHALLOW_COPY instead of DEEP_COPY_ALL it does not crash.

[code]
		osg::MatrixTransform* xform = new osg::MatrixTransform();
		osg::MatrixTransform* xform2 = new osg::MatrixTransform(osg::Matrix::translate(10.0,0.0,0.));

		osg::ref_ptr<osg::KdTreeBuilder> kdtreeBuilder = NULL;
		kdtreeBuilder = osgDB::Registry::instance()->getKdTreeBuilder()->clone();

		xform->addChild(cow);
//		xform->accept(*kdtreeBuilder);

		osg::Object * cow2 = cow->clone(osg::CopyOp::DEEP_COPY_ALL);

		xform2->addChild(cow2->asNode());

		group->addChild(xform);
		group->addChild(xform2);
[\code]




Cheers,
Ale

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




Attachments: 
http://forum.openscenegraph.org//files/osgpick_not_working_865.cpp




More information about the osg-users mailing list