mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 11:56:49 +01:00
Reorganized NavigationMesh.
This commit is contained in:
parent
a3aebe8bc5
commit
26ff340d47
@ -303,24 +303,6 @@ PoolVector<Vector3> NavigationMesh::get_vertices() const {
|
|||||||
return vertices;
|
return vertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigationMesh::_set_polygons(const Array &p_array) {
|
|
||||||
polygons.resize(p_array.size());
|
|
||||||
for (int i = 0; i < p_array.size(); i++) {
|
|
||||||
polygons.write[i] = p_array[i];
|
|
||||||
}
|
|
||||||
_change_notify();
|
|
||||||
}
|
|
||||||
|
|
||||||
Array NavigationMesh::_get_polygons() const {
|
|
||||||
Array ret;
|
|
||||||
ret.resize(polygons.size());
|
|
||||||
for (int i = 0; i < ret.size(); i++) {
|
|
||||||
ret[i] = polygons[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NavigationMesh::add_polygon(const Vector<int> &p_polygon) {
|
void NavigationMesh::add_polygon(const Vector<int> &p_polygon) {
|
||||||
polygons.push_back(p_polygon);
|
polygons.push_back(p_polygon);
|
||||||
navigation_mesh_dirty = true;
|
navigation_mesh_dirty = true;
|
||||||
@ -375,6 +357,24 @@ const Vector<Vector<int>> &NavigationMesh::get_polygons() const {
|
|||||||
return polygons;
|
return polygons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NavigationMesh::_set_polygons(const Array &p_array) {
|
||||||
|
polygons.resize(p_array.size());
|
||||||
|
for (int i = 0; i < p_array.size(); i++) {
|
||||||
|
polygons.write[i] = p_array[i];
|
||||||
|
}
|
||||||
|
_change_notify();
|
||||||
|
}
|
||||||
|
|
||||||
|
Array NavigationMesh::_get_polygons() const {
|
||||||
|
Array ret;
|
||||||
|
ret.resize(polygons.size());
|
||||||
|
for (int i = 0; i < ret.size(); i++) {
|
||||||
|
ret[i] = polygons[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
RID NavigationMesh::get_rid() const {
|
RID NavigationMesh::get_rid() const {
|
||||||
if (navmesh_rid.is_valid()) {
|
if (navmesh_rid.is_valid()) {
|
||||||
return navmesh_rid;
|
return navmesh_rid;
|
||||||
|
@ -40,23 +40,6 @@ class NavigationMesh : public Resource {
|
|||||||
|
|
||||||
friend class NavigationMeshGenerator;
|
friend class NavigationMeshGenerator;
|
||||||
|
|
||||||
RID navmesh_rid;
|
|
||||||
|
|
||||||
PoolVector<Vector3> vertices;
|
|
||||||
|
|
||||||
Vector<Vector<int>> polygons;
|
|
||||||
|
|
||||||
Ref<ArrayMesh> debug_mesh;
|
|
||||||
|
|
||||||
bool navigation_mesh_dirty;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
static void _bind_methods();
|
|
||||||
virtual void _validate_property(PropertyInfo &property) const;
|
|
||||||
|
|
||||||
void _set_polygons(const Array &p_array);
|
|
||||||
Array _get_polygons() const;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum SamplePartitionType {
|
enum SamplePartitionType {
|
||||||
SAMPLE_PARTITION_WATERSHED = 0,
|
SAMPLE_PARTITION_WATERSHED = 0,
|
||||||
@ -79,34 +62,6 @@ public:
|
|||||||
SOURCE_GEOMETRY_MAX
|
SOURCE_GEOMETRY_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
|
||||||
float cell_size;
|
|
||||||
float cell_height;
|
|
||||||
float agent_height;
|
|
||||||
float agent_radius;
|
|
||||||
float agent_max_climb;
|
|
||||||
float agent_max_slope;
|
|
||||||
float region_min_size;
|
|
||||||
float region_merge_size;
|
|
||||||
float edge_max_length;
|
|
||||||
float edge_max_error;
|
|
||||||
float verts_per_poly;
|
|
||||||
float detail_sample_distance;
|
|
||||||
float detail_sample_max_error;
|
|
||||||
|
|
||||||
SamplePartitionType partition_type;
|
|
||||||
ParsedGeometryType parsed_geometry_type;
|
|
||||||
uint32_t collision_mask;
|
|
||||||
|
|
||||||
SourceGeometryMode source_geometry_mode;
|
|
||||||
StringName source_group_name;
|
|
||||||
|
|
||||||
bool filter_low_hanging_obstacles;
|
|
||||||
bool filter_ledge_spans;
|
|
||||||
bool filter_walkable_low_height_spans;
|
|
||||||
AABB filter_baking_aabb;
|
|
||||||
Vector3 filter_baking_aabb_offset;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Recast settings
|
// Recast settings
|
||||||
void set_sample_partition_type(SamplePartitionType p_value);
|
void set_sample_partition_type(SamplePartitionType p_value);
|
||||||
@ -197,6 +152,9 @@ public:
|
|||||||
void set_polygons(const Vector<Vector<int>> &p_polygons);
|
void set_polygons(const Vector<Vector<int>> &p_polygons);
|
||||||
const Vector<Vector<int>> &get_polygons() const;
|
const Vector<Vector<int>> &get_polygons() const;
|
||||||
|
|
||||||
|
void _set_polygons(const Array &p_array);
|
||||||
|
Array _get_polygons() const;
|
||||||
|
|
||||||
RID get_rid() const;
|
RID get_rid() const;
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
@ -205,6 +163,48 @@ public:
|
|||||||
|
|
||||||
NavigationMesh();
|
NavigationMesh();
|
||||||
~NavigationMesh();
|
~NavigationMesh();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
virtual void _validate_property(PropertyInfo &property) const;
|
||||||
|
|
||||||
|
float cell_size;
|
||||||
|
float cell_height;
|
||||||
|
float agent_height;
|
||||||
|
float agent_radius;
|
||||||
|
float agent_max_climb;
|
||||||
|
float agent_max_slope;
|
||||||
|
float region_min_size;
|
||||||
|
float region_merge_size;
|
||||||
|
float edge_max_length;
|
||||||
|
float edge_max_error;
|
||||||
|
float verts_per_poly;
|
||||||
|
float detail_sample_distance;
|
||||||
|
float detail_sample_max_error;
|
||||||
|
|
||||||
|
SamplePartitionType partition_type;
|
||||||
|
ParsedGeometryType parsed_geometry_type;
|
||||||
|
uint32_t collision_mask;
|
||||||
|
|
||||||
|
SourceGeometryMode source_geometry_mode;
|
||||||
|
StringName source_group_name;
|
||||||
|
|
||||||
|
bool filter_low_hanging_obstacles;
|
||||||
|
bool filter_ledge_spans;
|
||||||
|
bool filter_walkable_low_height_spans;
|
||||||
|
AABB filter_baking_aabb;
|
||||||
|
Vector3 filter_baking_aabb_offset;
|
||||||
|
|
||||||
|
private:
|
||||||
|
RID navmesh_rid;
|
||||||
|
|
||||||
|
PoolVector<Vector3> vertices;
|
||||||
|
|
||||||
|
Vector<Vector<int>> polygons;
|
||||||
|
|
||||||
|
Ref<ArrayMesh> debug_mesh;
|
||||||
|
|
||||||
|
bool navigation_mesh_dirty;
|
||||||
};
|
};
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(NavigationMesh::SamplePartitionType);
|
VARIANT_ENUM_CAST(NavigationMesh::SamplePartitionType);
|
||||||
|
Loading…
Reference in New Issue
Block a user