1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-25 12:41:01 +00:00

Merge remote-tracking branch 'dteviot/Bug2871'

This commit is contained in:
Marc Zinnschlag 2015-08-20 20:42:35 +02:00
commit 08325d14ca
2 changed files with 21 additions and 8 deletions

View File

@ -53,7 +53,8 @@ namespace
{ {
assert(grid && !grid->mPoints.empty()); assert(grid && !grid->mPoints.empty());
float distanceBetween = distanceSquared(grid->mPoints[0], pos); float closestDistanceBetween = distanceSquared(grid->mPoints[0], pos);
float closestDistanceReachable = closestDistanceBetween;
int closestIndex = 0; int closestIndex = 0;
int closestReachableIndex = 0; int closestReachableIndex = 0;
// TODO: if this full scan causes performance problems mapping pathgrid // TODO: if this full scan causes performance problems mapping pathgrid
@ -61,17 +62,25 @@ namespace
for(unsigned int counter = 1; counter < grid->mPoints.size(); counter++) for(unsigned int counter = 1; counter < grid->mPoints.size(); counter++)
{ {
float potentialDistBetween = distanceSquared(grid->mPoints[counter], pos); float potentialDistBetween = distanceSquared(grid->mPoints[counter], pos);
if(potentialDistBetween < distanceBetween) if (potentialDistBetween < closestDistanceReachable)
{ {
// found a closer one // found a closer one
distanceBetween = potentialDistBetween;
closestIndex = counter;
if (cell->isPointConnected(start, counter)) if (cell->isPointConnected(start, counter))
{ {
closestDistanceReachable = potentialDistBetween;
closestReachableIndex = counter; closestReachableIndex = counter;
} }
if (potentialDistBetween < closestDistanceBetween)
{
closestDistanceBetween = potentialDistBetween;
closestIndex = counter;
}
} }
} }
// invariant: start and endpoint must be connected
assert(cell->isPointConnected(start, closestReachableIndex));
// AiWander has logic that depends on whether a path was created, deleting // AiWander has logic that depends on whether a path was created, deleting
// allowed nodes if not. Hence a path needs to be created even if the start // allowed nodes if not. Hence a path needs to be created even if the start
// and the end points are the same. // and the end points are the same.

View File

@ -126,12 +126,16 @@ namespace
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
osg::ref_ptr<osg::Geometry> geom;
#if defined(__APPLE__) #if defined(__APPLE__)
// FIXME: why are the extra flips needed on Mac? glReadPixels bug? // Extra flip needed on Intel graphics OS X systems due to a driver bug
osg::ref_ptr<osg::Geometry> geom = osg::createTexturedQuadGeometry(osg::Vec3(-1,1,0), osg::Vec3(2,0,0), osg::Vec3(0,-2,0)); std::string vendorString = (const char*)glGetString(GL_VENDOR);
#else if (vendorString.find("Intel") != std::string::npos)
osg::ref_ptr<osg::Geometry> geom = osg::createTexturedQuadGeometry(osg::Vec3(-1,-1,0), osg::Vec3(2,0,0), osg::Vec3(0,2,0)); geom = osg::createTexturedQuadGeometry(osg::Vec3(-1,1,0), osg::Vec3(2,0,0), osg::Vec3(0,-2,0));
else
#endif #endif
geom = osg::createTexturedQuadGeometry(osg::Vec3(-1,-1,0), osg::Vec3(2,0,0), osg::Vec3(0,2,0));
geom->drawImplementation(renderInfo); geom->drawImplementation(renderInfo);