diff options
Diffstat (limited to 'extension/src/MapMesh.cpp')
-rw-r--r-- | extension/src/MapMesh.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extension/src/MapMesh.cpp b/extension/src/MapMesh.cpp index 2fa6be4..cdbeec9 100644 --- a/extension/src/MapMesh.cpp +++ b/extension/src/MapMesh.cpp @@ -19,6 +19,7 @@ void MapMesh::_bind_methods() { ClassDB::bind_method(D_METHOD("get_subdivide_depth"), &MapMesh::get_subdivide_depth); ClassDB::bind_method(D_METHOD("get_core_aabb"), &MapMesh::get_core_aabb); + ClassDB::bind_method(D_METHOD("is_valid_uv_coord"), &MapMesh::is_valid_uv_coord); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "aspect_ratio", PROPERTY_HINT_NONE, "suffix:m"), "set_aspect_ratio", "get_aspect_ratio"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "repeat_proportion", PROPERTY_HINT_NONE, "suffix:m"), "set_repeat_proportion", "get_repeat_proportion"); @@ -72,6 +73,10 @@ AABB MapMesh::get_core_aabb() const { return AABB{ size * -0.5f, size }; } +bool MapMesh::is_valid_uv_coord(godot::Vector2 const& uv) const { + return -repeat_proportion <= uv.x && uv.x <= 1.0f + repeat_proportion && 0.0f <= uv.y && uv.y <= 1.0f; +} + Array MapMesh::_create_mesh_array() const { Array arr; arr.resize(Mesh::ARRAY_MAX); |