setup foo
This commit is contained in:
parent
7708b23d74
commit
6137a4ed7b
5 changed files with 49 additions and 4 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 21d526e5e5b1e5d8b6be4db05a704c2c2e7837a9
|
||||
Subproject commit a62f633cebee4b36356dc903d00670733cd28fb1
|
|
@ -26,4 +26,5 @@ void godot::RecastConfig::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_max_verts_per_poly", "max_verts_per_poly"), &RecastConfig::set_max_verts_per_poly);
|
||||
ClassDB::bind_method(D_METHOD("set_detail_sample_dist", "detail_sample_dist"), &RecastConfig::set_detail_sample_dist);
|
||||
ClassDB::bind_method(D_METHOD("set_detail_sample_max_error", "detail_sample_max_error"), &RecastConfig::set_detail_sample_max_error);
|
||||
ClassDB::bind_method(D_METHOD("set_partition_type", "partition_type"), &RecastConfig::set_partition_type);
|
||||
}
|
||||
|
|
|
@ -5,17 +5,24 @@
|
|||
#include "godot_cpp/classes/object.hpp"
|
||||
#include "godot_cpp/classes/node3d.hpp"
|
||||
|
||||
enum RecastPartitionTypes {
|
||||
WATERSHED,
|
||||
MONOTONE,
|
||||
LAYERS
|
||||
};
|
||||
|
||||
namespace godot {
|
||||
struct RecastConfig : public Object {
|
||||
GDCLASS(RecastConfig, Object)
|
||||
private:
|
||||
rcConfig config;
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
public:
|
||||
rcConfig config;
|
||||
RecastPartitionTypes partition_type = WATERSHED;
|
||||
|
||||
RecastConfig();
|
||||
~RecastConfig();
|
||||
rcConfig get_config() { return config; }
|
||||
/// The width of the field along the x-axis. [Limit: >= 0] [Units: vx]
|
||||
void set_width(int width) { config.width = width; }
|
||||
/// The height of the field along the z-axis. [Limit: >= 0] [Units: vx]
|
||||
|
@ -70,5 +77,22 @@ public:
|
|||
/// The maximum distance the detail mesh surface should deviate from heightfield
|
||||
/// data. (For height detail only.) [Limit: >=0] [Units: wu]
|
||||
void set_detail_sample_max_error(float detail_sample_max_error) { config.detailSampleMaxError = detail_sample_max_error; }
|
||||
/// The partition type to use for the heightfield.
|
||||
///
|
||||
/// Allowed values are:
|
||||
/// - WATERSHED
|
||||
/// - MONOTONE
|
||||
/// - LAYERS
|
||||
///
|
||||
/// Any other value will lead to no change in the partition type.
|
||||
void set_partition_type(const std::string& partition_type) {
|
||||
if (partition_type == "WATERSHED") {
|
||||
this->partition_type = WATERSHED;
|
||||
} else if (partition_type == "MONOTONE") {
|
||||
this->partition_type = MONOTONE;
|
||||
} else if (partition_type == "LAYERS") {
|
||||
this->partition_type = LAYERS;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ godot::RecastNavMesh::RecastNavMesh() {
|
|||
}
|
||||
|
||||
godot::RecastNavMesh::~RecastNavMesh() {
|
||||
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void godot::RecastNavMesh::_bind_methods() {
|
||||
|
@ -15,6 +15,25 @@ void godot::RecastNavMesh::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("is_calculated"), &RecastNavMesh::is_calculated);
|
||||
}
|
||||
|
||||
void godot::RecastNavMesh::cleanup() {
|
||||
/*
|
||||
delete [] m_triareas;
|
||||
m_triareas = 0;
|
||||
rcFreeHeightField(m_solid);
|
||||
m_solid = 0;
|
||||
rcFreeCompactHeightfield(m_chf);
|
||||
m_chf = 0;
|
||||
rcFreeContourSet(m_cset);
|
||||
m_cset = 0;
|
||||
rcFreePolyMesh(m_pmesh);
|
||||
m_pmesh = 0;
|
||||
rcFreePolyMeshDetail(m_dmesh);
|
||||
m_dmesh = 0;
|
||||
dtFreeNavMesh(m_navMesh);
|
||||
m_navMesh = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
bool godot::RecastNavMesh::add_vertices(const PackedByteArray& vertices, unsigned char area_id) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace godot {
|
|||
public:
|
||||
RecastNavMesh();
|
||||
~RecastNavMesh();
|
||||
void cleanup();
|
||||
void clear_vertices();
|
||||
bool add_vertices(const PackedByteArray& vertices, unsigned char area_id);
|
||||
bool recalculate_navmesh();
|
||||
|
|
Loading…
Reference in a new issue