Fixed a bug in the drive manipulator which was due to it using the local

coords of the intersection point with the scene rather than the world
coord value for that point.  The code now uses
osgUtil::Hit::getWorldIntersectionPoint() method for getting the world coords.

Added support for getWorldIntersectionPoint to Viewer.cpp.

Put and #ifdef around the setting of the default display list visitor so
it nolonger sets in under IRIX. This is a world around to the IR graphics
imbending lighting info into display lists, if the display lists are
created before state is set up it produces lighting artifacts such as
flickering.  Remove the the default display list init visitor removes
these problems, display lists are then built on the fly and drawables
a drawn for the first time.
This commit is contained in:
Robert Osfield
2002-02-10 17:16:43 +00:00
parent a08fc47313
commit d9398af300
3 changed files with 23 additions and 17 deletions

View File

@@ -72,8 +72,8 @@ void DriveManipulator::home(const GUIEventAdapter& ea,GUIActionAdapter& us)
if (!hitList.empty())
{
// notify(INFO) << "Hit terrain ok"<< std::endl;
osg::Vec3 ip = hitList.front()._intersectPoint;
osg::Vec3 np = hitList.front()._intersectNormal;
osg::Vec3 ip = hitList.front().getWorldIntersectPoint();
osg::Vec3 np = hitList.front().getWorldIntersectNormal();
osg::Vec3 uv;
if (np.z()>0.0f) uv = np;
@@ -111,8 +111,8 @@ void DriveManipulator::home(const GUIEventAdapter& ea,GUIActionAdapter& us)
if (!hitList.empty())
{
// notify(INFO) << "Hit terrain ok"<< std::endl;
osg::Vec3 ip = hitList.front()._intersectPoint;
osg::Vec3 np = hitList.front()._intersectNormal;
osg::Vec3 ip = hitList.front().getWorldIntersectPoint();
osg::Vec3 np = hitList.front().getWorldIntersectNormal();
osg::Vec3 uv;
if (np.z()>0.0f) uv = np;
@@ -187,8 +187,8 @@ void DriveManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us)
if (!hitList.empty())
{
// notify(INFO) << "Hit terrain ok"<< std::endl;
osg::Vec3 ip = hitList.front()._intersectPoint;
osg::Vec3 np = hitList.front()._intersectNormal;
osg::Vec3 ip = hitList.front().getWorldIntersectPoint();
osg::Vec3 np = hitList.front().getWorldIntersectNormal();
osg::Vec3 uv;
if (np.z()>0.0f) uv = np;
@@ -226,8 +226,8 @@ void DriveManipulator::init(const GUIEventAdapter& ea,GUIActionAdapter& us)
if (!hitList.empty())
{
// notify(INFO) << "Hit terrain ok"<< std::endl;
osg::Vec3 ip = hitList.front()._intersectPoint;
osg::Vec3 np = hitList.front()._intersectNormal;
osg::Vec3 ip = hitList.front().getWorldIntersectPoint();
osg::Vec3 np = hitList.front().getWorldIntersectNormal();
osg::Vec3 uv;
if (np.z()>0.0f) uv = np;
@@ -464,7 +464,7 @@ bool DriveManipulator::calcMovement()
if (!hitList.empty())
{
// notify(INFO) << "Hit obstruction"<< std::endl;
osg::Vec3 ip = hitList.front()._intersectPoint;
osg::Vec3 ip = hitList.front().getWorldIntersectPoint();
distanceToMove = (ip-ep).length()-_buffer;
_velocity = 0.0f;
}
@@ -489,8 +489,8 @@ bool DriveManipulator::calcMovement()
if (!hitList.empty())
{
// notify(INFO) << "Hit terrain ok"<< std::endl;
osg::Vec3 ip = hitList.front()._intersectPoint;
osg::Vec3 np = hitList.front()._intersectNormal;
osg::Vec3 ip = hitList.front().getWorldIntersectPoint();
osg::Vec3 np = hitList.front().getWorldIntersectNormal();
if (uv*np>0.0f) uv = np;
else uv = -np;
@@ -528,8 +528,8 @@ bool DriveManipulator::calcMovement()
{
notify(INFO) << "Hit terrain on decent ok"<< std::endl;
osg::Vec3 ip = hitList.front()._intersectPoint;
osg::Vec3 np = hitList.front()._intersectNormal;
osg::Vec3 ip = hitList.front().getWorldIntersectPoint();
osg::Vec3 np = hitList.front().getWorldIntersectNormal();
if (uv*np>0.0f) uv = np;
else uv = -np;