Fixed problems with intersection visitor coupled with the viewer.
This commit is contained in:
@@ -92,13 +92,13 @@ void Camera::copy(const Camera& camera)
|
||||
_useFarClippingPlane = camera._useFarClippingPlane;
|
||||
|
||||
// cached matrix and clipping volume derived from above settings.
|
||||
_dirty = camera._dirty;
|
||||
_projectionMatrix = camera._projectionMatrix;
|
||||
_modelViewMatrix = camera._modelViewMatrix;
|
||||
_clippingVolume = camera._clippingVolume;
|
||||
_dirty = false;// camera._dirty;
|
||||
_projectionMatrix = NULL; //camera._projectionMatrix;
|
||||
_modelViewMatrix = NULL; camera._modelViewMatrix;
|
||||
// _clippingVolume = camera._clippingVolume;
|
||||
|
||||
_mp = camera._mp;
|
||||
_inversemp = camera._inversemp;
|
||||
_mp = NULL;
|
||||
_inversemp = NULL;
|
||||
|
||||
_useEyeOffset = camera._useEyeOffset;
|
||||
_eyeOffset = camera._eyeOffset;
|
||||
|
||||
@@ -1031,12 +1031,12 @@ void Viewer::keyboard(unsigned char key, int x, int y)
|
||||
return;
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::LineSegment> LineSegment = new osg::LineSegment;
|
||||
LineSegment->set(near_point,far_point);
|
||||
osg::notify(osg::NOTICE) << "start("<<LineSegment->start()<<") end("<<LineSegment->end()<<")"<< std::endl;
|
||||
osg::ref_ptr<osg::LineSegment> lineSegment = new osg::LineSegment;
|
||||
lineSegment->set(near_point,far_point);
|
||||
osg::notify(osg::NOTICE) << "start("<<lineSegment->start()<<") end("<<lineSegment->end()<<")"<< std::endl;
|
||||
|
||||
osgUtil::IntersectVisitor iv;
|
||||
iv.addLineSegment(LineSegment.get());
|
||||
iv.addLineSegment(lineSegment.get());
|
||||
|
||||
float startTime = clockSeconds();
|
||||
|
||||
@@ -1048,7 +1048,7 @@ void Viewer::keyboard(unsigned char key, int x, int y)
|
||||
|
||||
if (iv.hits())
|
||||
{
|
||||
osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(LineSegment.get());
|
||||
osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(lineSegment.get());
|
||||
for(osgUtil::IntersectVisitor::HitList::iterator hitr=hitList.begin();
|
||||
hitr!=hitList.end();
|
||||
++hitr)
|
||||
|
||||
@@ -279,6 +279,7 @@ void SceneView::cull()
|
||||
}
|
||||
|
||||
camera->setNearFar(_near_plane,_far_plane);
|
||||
_camera->setNearFar(_near_plane,_far_plane);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user