mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-09 12:22:34 +01:00
Optimize AIGraph Slightly
This commit is contained in:
parent
95b6e6a676
commit
a20d170d16
@ -1,6 +1,7 @@
|
|||||||
#include "ai/AIGraph.hpp"
|
#include "ai/AIGraph.hpp"
|
||||||
#include "objects/InstanceObject.hpp"
|
#include "objects/InstanceObject.hpp"
|
||||||
#include <ai/AIGraphNode.hpp>
|
#include <ai/AIGraphNode.hpp>
|
||||||
|
#include <glm/gtx/norm.hpp>
|
||||||
|
|
||||||
AIGraph::~AIGraph()
|
AIGraph::~AIGraph()
|
||||||
{
|
{
|
||||||
@ -22,7 +23,11 @@ void AIGraph::createPathNodes(const glm::vec3& position, const glm::quat& rotati
|
|||||||
|
|
||||||
if( node.type == PathNode::EXTERNAL ) {
|
if( node.type == PathNode::EXTERNAL ) {
|
||||||
for( size_t rn = 0; rn < nodes.size(); ++rn ) {
|
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 ) {
|
if( d < 1.f ) {
|
||||||
realNodes.push_back(rn);
|
realNodes.push_back(rn);
|
||||||
ainode = nodes[rn];
|
ainode = nodes[rn];
|
||||||
|
Loading…
Reference in New Issue
Block a user