aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/MapMesh.hpp
blob: 20383cae0dbf519bac6f346ff3830607a121284e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include <godot_cpp/classes/primitive_mesh.hpp>

namespace OpenVic {
   class MapMesh : public godot::PrimitiveMesh {
      GDCLASS(MapMesh, godot::PrimitiveMesh)

      float aspect_ratio = 2.0f, repeat_proportion = 0.5f;
      int32_t subdivide_w = 0, subdivide_d = 0;

   protected:
      static void _bind_methods();
      void _request_update();

   public:
      void set_aspect_ratio(float ratio);
      float get_aspect_ratio() const;

      void set_repeat_proportion(float proportion);
      float get_repeat_proportion() const;

      void set_subdivide_width(int32_t divisions);
      int32_t get_subdivide_width() const;

      void set_subdivide_depth(int32_t divisions);
      int32_t get_subdivide_depth() const;

      godot::AABB get_core_aabb() const;
      bool is_valid_uv_coord(godot::Vector2 const& uv) const;

      godot::Array _create_mesh_array() const override;
   };
}