aboutsummaryrefslogtreecommitdiff
path: root/extension/src/MapMesh.cpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-04-07 01:42:53 +0200
committer Hop311 <hop3114@gmail.com>2023-04-07 01:42:53 +0200
commit513a1328edb89ac695c70164158933aee4546cd7 (patch)
tree8d979d4e8c728bb80543aa13e037a328829122fd /extension/src/MapMesh.cpp
parent14c2358c7837e644349ea37866607fcd1459d2bc (diff)
Province index and colour lookup texture
Diffstat (limited to 'extension/src/MapMesh.cpp')
-rw-r--r--extension/src/MapMesh.cpp5
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);