aboutsummaryrefslogtreecommitdiff
path: root/extension/src/MapMesh.hpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-04-05 19:38:40 +0200
committer Hop311 <hop3114@gmail.com>2023-04-05 19:38:40 +0200
commit2d47ff8c02a4ee88270634289381140f8ac1617e (patch)
tree920dc801e7bf5f83b9cca110a437a2e64524f1d7 /extension/src/MapMesh.hpp
parent29b334995b084e5d6944c45b7950c88f370941cc (diff)
Custom map mesh that fixes UV issue
Diffstat (limited to 'extension/src/MapMesh.hpp')
-rw-r--r--extension/src/MapMesh.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/extension/src/MapMesh.hpp b/extension/src/MapMesh.hpp
new file mode 100644
index 0000000..5427894
--- /dev/null
+++ b/extension/src/MapMesh.hpp
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <godot_cpp/classes/primitive_mesh.hpp>
+
+namespace OpenVic2 {
+ class MapMesh : public godot::PrimitiveMesh {
+ GDCLASS(MapMesh, godot::PrimitiveMesh)
+
+ float aspect_ratio = 2.0f, repeat_proportion = 0.5f;
+ int subdivide_w = 0, subdivide_d = 0;
+
+ protected:
+ static void _bind_methods();
+ void _request_update();
+
+ public:
+ void set_aspect_ratio(const float ratio);
+ float get_aspect_ratio() const;
+
+ void set_repeat_proportion(const float proportion);
+ float get_repeat_proportion() const;
+
+ void set_subdivide_width(const int divisions);
+ int get_subdivide_width() const;
+
+ void set_subdivide_depth(const int divisions);
+ int get_subdivide_depth() const;
+
+ godot::AABB get_core_aabb() const;
+
+ godot::Array _create_mesh_array() const override;
+ };
+}