1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

Optimize AIGraph Slightly

This commit is contained in:
Daniel Evans 2015-04-03 16:15:58 +01:00
parent 95b6e6a676
commit a20d170d16

View File

@ -1,6 +1,7 @@
#include "ai/AIGraph.hpp"
#include "objects/InstanceObject.hpp"
#include <ai/AIGraphNode.hpp>
#include <glm/gtx/norm.hpp>
AIGraph::~AIGraph()
{
@ -22,7 +23,11 @@ void AIGraph::createPathNodes(const glm::vec3& position, const glm::quat& rotati
if( node.type == PathNode::EXTERNAL ) {
for( size_t rn = 0; rn < nodes.size(); ++rn ) {
auto d = glm::length(nodes[rn]->position - nodePosition);
if(! nodes[rn]->external )
{
continue;
}
auto d = glm::distance2(nodes[rn]->position, nodePosition);
if( d < 1.f ) {
realNodes.push_back(rn);
ainode = nodes[rn];