Made the LineSegment destructor protected to force users to create segments
on the stack thus ensure that they arn't created locally and have their memory deleted incorrectly. Also updated the IntersectVisitor so that it no used osg::ref_ptr<> internally for storing all data. Have also move the IntersectState helper class to inside the IntersectVisitor which simplifies the external interface to the class.
This commit is contained in:
@@ -1055,9 +1055,9 @@ void Viewer::keyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
osg::Vec3 ip = hitr->_intersectPoint;
|
||||
osg::Vec3 in = hitr->_intersectNormal;
|
||||
osg::Geode* geode = hitr->_geode;
|
||||
osg::Geode* geode = hitr->_geode.get();
|
||||
osg::notify(osg::NOTICE) << " Itersection Point ("<<ip<<") Normal ("<<in<<")"<< std::endl;
|
||||
if (hitr->_matrix)
|
||||
if (hitr->_matrix.valid())
|
||||
{
|
||||
osg::Vec3 ipEye = ip*(*(hitr->_matrix));
|
||||
osg::Vec3 inEye = (in+ip)*(*(hitr->_matrix))-ipEye;
|
||||
@@ -1069,7 +1069,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
|
||||
if (key=='r' && geode)
|
||||
{
|
||||
// remove geoset..
|
||||
osg::GeoSet* gset = hitr->_geoset;
|
||||
osg::GeoSet* gset = hitr->_geoset.get();
|
||||
osg::notify(osg::NOTICE) << " geoset ("<<gset<<") "<<geode->removeDrawable(gset)<<")"<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user