Compare commits
No commits in common. "fd20de9dccbd06fe87908b546966d34ae1ed8ac2" and "1c9b58207e9c899b0d83cd05eabf098ca3f3e54f" have entirely different histories.
fd20de9dcc
...
1c9b58207e
@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
#include "Node.h"
|
||||
#include "Path.h"
|
||||
|
||||
namespace Gedeng {
|
||||
|
||||
// A NavMesh can be constructed from the geometry in a node tree in order to be
|
||||
// used for pathfinding. A typical scenario would go as follows:
|
||||
// 1. Load Nodes using NodeSystem::load_nodes_from_disk
|
||||
// 2. Create a NavMesh using NavMesh::create_from_nodes
|
||||
// 3. Verify the resulting NavMesh via NavMesh::is_valid
|
||||
// 4. Get a path between the desired points via NavMesh::get_path
|
||||
// 5. Position an entity along this path via Path::get_interpolated_position
|
||||
class NavMesh {
|
||||
// Build the NavMesh from all collider geometry in the given node and all
|
||||
// its children.
|
||||
void create_from_nodes(const Node &root);
|
||||
|
||||
// Return true if the NavMesh has succesfully been created from nodes (by a
|
||||
// former `create_from_nodes` call) and its geometry is valid.
|
||||
bool is_valid() const;
|
||||
|
||||
// Return a valid and optimal path from a given Vector3 to a given Vector3.
|
||||
// If no valid path can be constructed, the returned path will be of size 1
|
||||
// and contain only the `from` vector.
|
||||
Path get_path(const Vector3 &from, const Vector3 &to) const;
|
||||
|
||||
// Return any valid path from a given Vector3 to a given Vector3.
|
||||
// This is more performant than `get_path`, but the returned path may not be
|
||||
// optimal -- if that is undesired, call `get_path` instead.
|
||||
Path get_unoptimized_path(const Vector3 &from, const Vector3 &to) const;
|
||||
};
|
||||
|
||||
} // namespace Gedeng
|
@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
#include "Gedeng/String.h"
|
||||
#include "Gedeng/Vector.h"
|
||||
|
||||
namespace Gedeng {
|
||||
|
||||
class Node {
|
||||
// Add the given node as a child of this node.
|
||||
void add_child(const Node &node);
|
||||
|
||||
// Return a vector with all child nodes of this node.
|
||||
Vector<Node &> get_children() const;
|
||||
};
|
||||
|
||||
} // namespace Gedeng
|
@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
#include "Gedeng/Node.h"
|
||||
#include "Gedeng/String.h"
|
||||
|
||||
namespace Gedeng {
|
||||
|
||||
class NodeSystem {
|
||||
// Load a node with all its children from a node definition file (`.gnd`) on
|
||||
// disk.
|
||||
static Node load_nodes_from_disk(const String &path);
|
||||
|
||||
// Save a node and all its children to disk, at the given path. It is
|
||||
// recommended to end the path with `.gnd`.
|
||||
static void save_nodes_to_disk(const Node &node, const String &path);
|
||||
};
|
||||
|
||||
} // namespace Gedeng
|
@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
#include "Vector3.h"
|
||||
|
||||
namespace Gedeng {
|
||||
|
||||
class Path {
|
||||
// Return a Vector3 on the path. `t` should be between 0 (path begin) and 1
|
||||
// (path end).
|
||||
Vector3 get_interpolated_position(float t) const;
|
||||
|
||||
// Return the number of Vector3's which make up the path.
|
||||
unsigned int get_size() const;
|
||||
};
|
||||
|
||||
} // namespace Gedeng
|
@ -1,7 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace Gedeng {
|
||||
|
||||
class Vector3 {};
|
||||
|
||||
} // namespace Gedeng
|
Loading…
x
Reference in New Issue
Block a user