tile_map_layer.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. /**************************************************************************/
  2. /* tile_map_layer.h */
  3. /**************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /**************************************************************************/
  8. /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
  9. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /**************************************************************************/
  30. #ifndef TILE_MAP_LAYER_H
  31. #define TILE_MAP_LAYER_H
  32. #include "scene/resources/2d/tile_set.h"
  33. class NavigationMeshSourceGeometryData2D;
  34. class TileSetAtlasSource;
  35. class TileMap;
  36. enum TileMapLayerDataFormat {
  37. TILE_MAP_LAYER_DATA_FORMAT_0 = 0,
  38. TILE_MAP_LAYER_DATA_FORMAT_MAX,
  39. };
  40. class TerrainConstraint {
  41. private:
  42. Ref<TileSet> tile_set;
  43. Vector2i base_cell_coords;
  44. int bit = -1;
  45. int terrain = -1;
  46. int priority = 1;
  47. public:
  48. bool operator<(const TerrainConstraint &p_other) const {
  49. if (base_cell_coords == p_other.base_cell_coords) {
  50. return bit < p_other.bit;
  51. }
  52. return base_cell_coords < p_other.base_cell_coords;
  53. }
  54. String to_string() const {
  55. return vformat("Constraint {pos:%s, bit:%d, terrain:%d, priority:%d}", base_cell_coords, bit, terrain, priority);
  56. }
  57. Vector2i get_base_cell_coords() const {
  58. return base_cell_coords;
  59. }
  60. bool is_center_bit() const {
  61. return bit == 0;
  62. }
  63. HashMap<Vector2i, TileSet::CellNeighbor> get_overlapping_coords_and_peering_bits() const;
  64. void set_terrain(int p_terrain) {
  65. terrain = p_terrain;
  66. }
  67. int get_terrain() const {
  68. return terrain;
  69. }
  70. void set_priority(int p_priority) {
  71. priority = p_priority;
  72. }
  73. int get_priority() const {
  74. return priority;
  75. }
  76. TerrainConstraint(Ref<TileSet> p_tile_set, const Vector2i &p_position, int p_terrain); // For the center terrain bit
  77. TerrainConstraint(Ref<TileSet> p_tile_set, const Vector2i &p_position, const TileSet::CellNeighbor &p_bit, int p_terrain); // For peering bits
  78. TerrainConstraint() {}
  79. };
  80. #ifdef DEBUG_ENABLED
  81. class DebugQuadrant;
  82. #endif // DEBUG_ENABLED
  83. class RenderingQuadrant;
  84. struct CellData {
  85. Vector2i coords;
  86. TileMapCell cell;
  87. // Debug.
  88. SelfList<CellData> debug_quadrant_list_element;
  89. // Rendering.
  90. Ref<RenderingQuadrant> rendering_quadrant;
  91. SelfList<CellData> rendering_quadrant_list_element;
  92. LocalVector<LocalVector<RID>> occluders;
  93. // Physics.
  94. LocalVector<RID> bodies;
  95. // Navigation.
  96. LocalVector<RID> navigation_regions;
  97. // Scenes.
  98. String scene;
  99. // Runtime TileData cache.
  100. TileData *runtime_tile_data_cache = nullptr;
  101. // List elements.
  102. SelfList<CellData> dirty_list_element;
  103. bool operator<(const CellData &p_other) const {
  104. return coords < p_other.coords;
  105. }
  106. // For those, copy everything but SelfList elements.
  107. void operator=(const CellData &p_other) {
  108. coords = p_other.coords;
  109. cell = p_other.cell;
  110. occluders = p_other.occluders;
  111. bodies = p_other.bodies;
  112. navigation_regions = p_other.navigation_regions;
  113. scene = p_other.scene;
  114. runtime_tile_data_cache = p_other.runtime_tile_data_cache;
  115. }
  116. CellData(const CellData &p_other) :
  117. debug_quadrant_list_element(this),
  118. rendering_quadrant_list_element(this),
  119. dirty_list_element(this) {
  120. coords = p_other.coords;
  121. cell = p_other.cell;
  122. occluders = p_other.occluders;
  123. bodies = p_other.bodies;
  124. navigation_regions = p_other.navigation_regions;
  125. scene = p_other.scene;
  126. runtime_tile_data_cache = p_other.runtime_tile_data_cache;
  127. }
  128. CellData() :
  129. debug_quadrant_list_element(this),
  130. rendering_quadrant_list_element(this),
  131. dirty_list_element(this) {
  132. }
  133. };
  134. // We use another comparator for Y-sorted layers with reversed X drawing order.
  135. struct CellDataYSortedXReversedComparator {
  136. _FORCE_INLINE_ bool operator()(const CellData &p_a, const CellData &p_b) const {
  137. return p_a.coords.x == p_b.coords.x ? (p_a.coords.y < p_b.coords.y) : (p_a.coords.x > p_b.coords.x);
  138. }
  139. };
  140. #ifdef DEBUG_ENABLED
  141. class DebugQuadrant : public RefCounted {
  142. GDCLASS(DebugQuadrant, RefCounted);
  143. public:
  144. Vector2i quadrant_coords;
  145. SelfList<CellData>::List cells;
  146. RID canvas_item;
  147. SelfList<DebugQuadrant> dirty_quadrant_list_element;
  148. DebugQuadrant() :
  149. dirty_quadrant_list_element(this) {
  150. }
  151. ~DebugQuadrant() {
  152. cells.clear();
  153. }
  154. };
  155. #endif // DEBUG_ENABLED
  156. class RenderingQuadrant : public RefCounted {
  157. GDCLASS(RenderingQuadrant, RefCounted);
  158. public:
  159. struct CoordsWorldComparator {
  160. _ALWAYS_INLINE_ bool operator()(const Vector2 &p_a, const Vector2 &p_b) const {
  161. // We sort the cells by their local coords, as it is needed by rendering.
  162. if (p_a.y == p_b.y) {
  163. return p_a.x > p_b.x;
  164. } else {
  165. return p_a.y < p_b.y;
  166. }
  167. }
  168. };
  169. Vector2i quadrant_coords;
  170. SelfList<CellData>::List cells;
  171. List<RID> canvas_items;
  172. Vector2 canvas_items_position;
  173. SelfList<RenderingQuadrant> dirty_quadrant_list_element;
  174. RenderingQuadrant() :
  175. dirty_quadrant_list_element(this) {
  176. }
  177. ~RenderingQuadrant() {
  178. cells.clear();
  179. }
  180. };
  181. class TileMapLayer : public Node2D {
  182. GDCLASS(TileMapLayer, Node2D);
  183. public:
  184. enum HighlightMode {
  185. HIGHLIGHT_MODE_DEFAULT,
  186. HIGHLIGHT_MODE_ABOVE,
  187. HIGHLIGHT_MODE_BELOW,
  188. };
  189. enum DebugVisibilityMode {
  190. DEBUG_VISIBILITY_MODE_DEFAULT,
  191. DEBUG_VISIBILITY_MODE_FORCE_SHOW,
  192. DEBUG_VISIBILITY_MODE_FORCE_HIDE,
  193. };
  194. enum DirtyFlags {
  195. DIRTY_FLAGS_LAYER_ENABLED = 0,
  196. DIRTY_FLAGS_LAYER_IN_TREE,
  197. DIRTY_FLAGS_LAYER_IN_CANVAS,
  198. DIRTY_FLAGS_LAYER_LOCAL_TRANSFORM,
  199. DIRTY_FLAGS_LAYER_VISIBILITY,
  200. DIRTY_FLAGS_LAYER_SELF_MODULATE,
  201. DIRTY_FLAGS_LAYER_Y_SORT_ENABLED,
  202. DIRTY_FLAGS_LAYER_Y_SORT_ORIGIN,
  203. DIRTY_FLAGS_LAYER_X_DRAW_ORDER_REVERSED,
  204. DIRTY_FLAGS_LAYER_Z_INDEX,
  205. DIRTY_FLAGS_LAYER_LIGHT_MASK,
  206. DIRTY_FLAGS_LAYER_TEXTURE_FILTER,
  207. DIRTY_FLAGS_LAYER_TEXTURE_REPEAT,
  208. DIRTY_FLAGS_LAYER_RENDERING_QUADRANT_SIZE,
  209. DIRTY_FLAGS_LAYER_COLLISION_ENABLED,
  210. DIRTY_FLAGS_LAYER_USE_KINEMATIC_BODIES,
  211. DIRTY_FLAGS_LAYER_COLLISION_VISIBILITY_MODE,
  212. DIRTY_FLAGS_LAYER_OCCLUSION_ENABLED,
  213. DIRTY_FLAGS_LAYER_NAVIGATION_ENABLED,
  214. DIRTY_FLAGS_LAYER_NAVIGATION_MAP,
  215. DIRTY_FLAGS_LAYER_NAVIGATION_VISIBILITY_MODE,
  216. DIRTY_FLAGS_LAYER_RUNTIME_UPDATE,
  217. DIRTY_FLAGS_LAYER_INDEX_IN_TILE_MAP_NODE, // For compatibility.
  218. DIRTY_FLAGS_LAYER_GROUP_SELECTED_LAYERS,
  219. DIRTY_FLAGS_LAYER_GROUP_HIGHLIGHT_SELECTED,
  220. DIRTY_FLAGS_TILE_SET,
  221. DIRTY_FLAGS_MAX,
  222. };
  223. private:
  224. static constexpr float FP_ADJUST = 0.00001;
  225. // Properties.
  226. HashMap<Vector2i, CellData> tile_map_layer_data;
  227. bool enabled = true;
  228. Ref<TileSet> tile_set;
  229. HighlightMode highlight_mode = HIGHLIGHT_MODE_DEFAULT;
  230. int y_sort_origin = 0;
  231. bool x_draw_order_reversed = false;
  232. int rendering_quadrant_size = 16;
  233. bool collision_enabled = true;
  234. bool use_kinematic_bodies = false;
  235. DebugVisibilityMode collision_visibility_mode = DEBUG_VISIBILITY_MODE_DEFAULT;
  236. bool occlusion_enabled = true;
  237. bool navigation_enabled = true;
  238. RID navigation_map_override;
  239. DebugVisibilityMode navigation_visibility_mode = DEBUG_VISIBILITY_MODE_DEFAULT;
  240. // Internal.
  241. bool pending_update = false;
  242. // For keeping compatibility with TileMap.
  243. TileMap *tile_map_node = nullptr;
  244. int layer_index_in_tile_map_node = -1;
  245. // Dirty flag. Allows knowing what was modified since the last update.
  246. struct {
  247. bool flags[DIRTY_FLAGS_MAX] = { false };
  248. SelfList<CellData>::List cell_list;
  249. } dirty;
  250. // Rect cache.
  251. mutable Rect2 rect_cache;
  252. mutable bool rect_cache_dirty = true;
  253. mutable Rect2i used_rect_cache;
  254. mutable bool used_rect_cache_dirty = true;
  255. // Runtime tile data.
  256. bool _runtime_update_tile_data_was_cleaned_up = false;
  257. void _build_runtime_update_tile_data(bool p_force_cleanup);
  258. void _build_runtime_update_tile_data_for_cell(CellData &r_cell_data, bool p_use_tilemap_for_runtime, bool p_auto_add_to_dirty_list = false);
  259. bool _runtime_update_needs_all_cells_cleaned_up = false;
  260. void _clear_runtime_update_tile_data();
  261. void _clear_runtime_update_tile_data_for_cell(CellData &r_cell_data);
  262. void _update_cells_callback(bool p_force_cleanup);
  263. // Per-system methods.
  264. #ifdef DEBUG_ENABLED
  265. HashMap<Vector2i, Ref<DebugQuadrant>> debug_quadrant_map;
  266. Vector2i _coords_to_debug_quadrant_coords(const Vector2i &p_coords) const;
  267. bool _debug_was_cleaned_up = false;
  268. void _debug_update(bool p_force_cleanup);
  269. void _debug_quadrants_update_cell(CellData &r_cell_data, SelfList<DebugQuadrant>::List &r_dirty_debug_quadrant_list);
  270. #endif // DEBUG_ENABLED
  271. HashMap<Vector2i, Ref<RenderingQuadrant>> rendering_quadrant_map;
  272. bool _rendering_was_cleaned_up = false;
  273. void _rendering_update(bool p_force_cleanup);
  274. void _rendering_notification(int p_what);
  275. void _rendering_quadrants_update_cell(CellData &r_cell_data, SelfList<RenderingQuadrant>::List &r_dirty_rendering_quadrant_list);
  276. void _rendering_occluders_clear_cell(CellData &r_cell_data);
  277. void _rendering_occluders_update_cell(CellData &r_cell_data);
  278. #ifdef DEBUG_ENABLED
  279. void _rendering_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data);
  280. #endif // DEBUG_ENABLED
  281. HashMap<RID, Vector2i> bodies_coords; // Mapping for RID to coords.
  282. bool _physics_was_cleaned_up = false;
  283. void _physics_update(bool p_force_cleanup);
  284. void _physics_notification(int p_what);
  285. void _physics_clear_cell(CellData &r_cell_data);
  286. void _physics_update_cell(CellData &r_cell_data);
  287. #ifdef DEBUG_ENABLED
  288. void _physics_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data);
  289. #endif // DEBUG_ENABLED
  290. bool _navigation_was_cleaned_up = false;
  291. void _navigation_update(bool p_force_cleanup);
  292. void _navigation_notification(int p_what);
  293. void _navigation_clear_cell(CellData &r_cell_data);
  294. void _navigation_update_cell(CellData &r_cell_data);
  295. #ifdef DEBUG_ENABLED
  296. void _navigation_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data);
  297. #endif // DEBUG_ENABLED
  298. bool _scenes_was_cleaned_up = false;
  299. void _scenes_update(bool p_force_cleanup);
  300. void _scenes_clear_cell(CellData &r_cell_data);
  301. void _scenes_update_cell(CellData &r_cell_data);
  302. #ifdef DEBUG_ENABLED
  303. void _scenes_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data);
  304. #endif // DEBUG_ENABLED
  305. // Terrains.
  306. TileSet::TerrainsPattern _get_best_terrain_pattern_for_constraints(int p_terrain_set, const Vector2i &p_position, const RBSet<TerrainConstraint> &p_constraints, TileSet::TerrainsPattern p_current_pattern) const;
  307. RBSet<TerrainConstraint> _get_terrain_constraints_from_added_pattern(const Vector2i &p_position, int p_terrain_set, TileSet::TerrainsPattern p_terrains_pattern) const;
  308. RBSet<TerrainConstraint> _get_terrain_constraints_from_painted_cells_list(const RBSet<Vector2i> &p_painted, int p_terrain_set, bool p_ignore_empty_terrains) const;
  309. void _tile_set_changed();
  310. void _renamed();
  311. void _update_notify_local_transform();
  312. // Internal updates.
  313. void _queue_internal_update();
  314. void _deferred_internal_update();
  315. void _internal_update(bool p_force_cleanup);
  316. virtual void _physics_interpolated_changed() override;
  317. protected:
  318. void _notification(int p_what);
  319. static void _bind_methods();
  320. void _validate_property(PropertyInfo &p_property) const;
  321. virtual void _update_self_texture_filter(RS::CanvasItemTextureFilter p_texture_filter) override;
  322. virtual void _update_self_texture_repeat(RS::CanvasItemTextureRepeat p_texture_repeat) override;
  323. public:
  324. #ifdef TOOLS_ENABLED
  325. virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const override;
  326. #endif
  327. // TileMap node.
  328. void set_as_tile_map_internal_node(int p_index);
  329. int get_index_in_tile_map() const {
  330. return layer_index_in_tile_map_node;
  331. }
  332. const HashMap<Vector2i, CellData> &get_tile_map_layer_data() const {
  333. return tile_map_layer_data;
  334. }
  335. // Rect caching.
  336. Rect2 get_rect(bool &r_changed) const;
  337. // Terrains.
  338. HashMap<Vector2i, TileSet::TerrainsPattern> terrain_fill_constraints(const Vector<Vector2i> &p_to_replace, int p_terrain_set, const RBSet<TerrainConstraint> &p_constraints) const; // Not exposed.
  339. HashMap<Vector2i, TileSet::TerrainsPattern> terrain_fill_connect(const Vector<Vector2i> &p_coords_array, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains = true) const; // Not exposed.
  340. HashMap<Vector2i, TileSet::TerrainsPattern> terrain_fill_path(const Vector<Vector2i> &p_coords_array, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains = true) const; // Not exposed.
  341. HashMap<Vector2i, TileSet::TerrainsPattern> terrain_fill_pattern(const Vector<Vector2i> &p_coords_array, int p_terrain_set, TileSet::TerrainsPattern p_terrains_pattern, bool p_ignore_empty_terrains = true) const; // Not exposed.
  342. // Not exposed to users.
  343. TileMapCell get_cell(const Vector2i &p_coords) const;
  344. static void draw_tile(RID p_canvas_item, const Vector2 &p_position, const Ref<TileSet> p_tile_set, int p_atlas_source_id, const Vector2i &p_atlas_coords, int p_alternative_tile, int p_frame = -1, Color p_modulation = Color(1.0, 1.0, 1.0, 1.0), const TileData *p_tile_data_override = nullptr, real_t p_normalized_animation_offset = 0.0);
  345. ////////////// Exposed functions //////////////
  346. // --- Cells manipulation ---
  347. // Generic cells manipulations and data access.
  348. void set_cell(const Vector2i &p_coords, int p_source_id = TileSet::INVALID_SOURCE, const Vector2i &p_atlas_coords = TileSetSource::INVALID_ATLAS_COORDS, int p_alternative_tile = 0);
  349. void erase_cell(const Vector2i &p_coords);
  350. void fix_invalid_tiles();
  351. void clear();
  352. int get_cell_source_id(const Vector2i &p_coords) const;
  353. Vector2i get_cell_atlas_coords(const Vector2i &p_coords) const;
  354. int get_cell_alternative_tile(const Vector2i &p_coords) const;
  355. TileData *get_cell_tile_data(const Vector2i &p_coords) const; // Helper method to make accessing the data easier.
  356. TypedArray<Vector2i> get_used_cells() const;
  357. TypedArray<Vector2i> get_used_cells_by_id(int p_source_id = TileSet::INVALID_SOURCE, const Vector2i &p_atlas_coords = TileSetSource::INVALID_ATLAS_COORDS, int p_alternative_tile = TileSetSource::INVALID_TILE_ALTERNATIVE) const;
  358. Rect2i get_used_rect() const;
  359. bool is_cell_flipped_h(const Vector2i &p_coords) const;
  360. bool is_cell_flipped_v(const Vector2i &p_coords) const;
  361. bool is_cell_transposed(const Vector2i &p_coords) const;
  362. // Patterns.
  363. Ref<TileMapPattern> get_pattern(TypedArray<Vector2i> p_coords_array);
  364. void set_pattern(const Vector2i &p_position, const Ref<TileMapPattern> p_pattern);
  365. // Terrains.
  366. void set_cells_terrain_connect(TypedArray<Vector2i> p_cells, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains = true);
  367. void set_cells_terrain_path(TypedArray<Vector2i> p_path, int p_terrain_set, int p_terrain, bool p_ignore_empty_terrains = true);
  368. // --- Physics helpers ---
  369. bool has_body_rid(RID p_physics_body) const;
  370. Vector2i get_coords_for_body_rid(RID p_physics_body) const; // For finding tiles from collision.
  371. // --- Runtime ---
  372. void update_internals();
  373. void notify_runtime_tile_data_update();
  374. GDVIRTUAL1R(bool, _use_tile_data_runtime_update, Vector2i);
  375. GDVIRTUAL2(_tile_data_runtime_update, Vector2i, TileData *);
  376. GDVIRTUAL2(_update_cells, TypedArray<Vector2i>, bool);
  377. // --- Shortcuts to methods defined in TileSet ---
  378. Vector2i map_pattern(const Vector2i &p_position_in_tilemap, const Vector2i &p_coords_in_pattern, Ref<TileMapPattern> p_pattern);
  379. TypedArray<Vector2i> get_surrounding_cells(const Vector2i &p_coords);
  380. Vector2i get_neighbor_cell(const Vector2i &p_coords, TileSet::CellNeighbor p_cell_neighbor) const;
  381. Vector2 map_to_local(const Vector2i &p_pos) const;
  382. Vector2i local_to_map(const Vector2 &p_pos) const;
  383. // --- Accessors ---
  384. void set_tile_map_data_from_array(const Vector<uint8_t> &p_data);
  385. Vector<uint8_t> get_tile_map_data_as_array() const;
  386. void set_enabled(bool p_enabled);
  387. bool is_enabled() const;
  388. void set_tile_set(const Ref<TileSet> &p_tile_set);
  389. Ref<TileSet> get_tile_set() const;
  390. void set_highlight_mode(HighlightMode p_highlight_mode);
  391. HighlightMode get_highlight_mode() const;
  392. virtual void set_self_modulate(const Color &p_self_modulate) override;
  393. virtual void set_y_sort_enabled(bool p_y_sort_enabled) override;
  394. void set_y_sort_origin(int p_y_sort_origin);
  395. int get_y_sort_origin() const;
  396. void set_x_draw_order_reversed(bool p_x_draw_order_reversed);
  397. bool is_x_draw_order_reversed() const;
  398. virtual void set_z_index(int p_z_index) override;
  399. virtual void set_light_mask(int p_light_mask) override;
  400. void set_rendering_quadrant_size(int p_size);
  401. int get_rendering_quadrant_size() const;
  402. void set_collision_enabled(bool p_enabled);
  403. bool is_collision_enabled() const;
  404. void set_use_kinematic_bodies(bool p_use_kinematic_bodies);
  405. bool is_using_kinematic_bodies() const;
  406. void set_collision_visibility_mode(DebugVisibilityMode p_show_collision);
  407. DebugVisibilityMode get_collision_visibility_mode() const;
  408. void set_occlusion_enabled(bool p_enabled);
  409. bool is_occlusion_enabled() const;
  410. void set_navigation_enabled(bool p_enabled);
  411. bool is_navigation_enabled() const;
  412. void set_navigation_map(RID p_map);
  413. RID get_navigation_map() const;
  414. void set_navigation_visibility_mode(DebugVisibilityMode p_show_navigation);
  415. DebugVisibilityMode get_navigation_visibility_mode() const;
  416. private:
  417. static Callable _navmesh_source_geometry_parsing_callback;
  418. static RID _navmesh_source_geometry_parser;
  419. public:
  420. static void navmesh_parse_init();
  421. static void navmesh_parse_source_geometry(const Ref<NavigationPolygon> &p_navigation_mesh, Ref<NavigationMeshSourceGeometryData2D> p_source_geometry_data, Node *p_node);
  422. TileMapLayer();
  423. ~TileMapLayer();
  424. };
  425. VARIANT_ENUM_CAST(TileMapLayer::DebugVisibilityMode);
  426. #endif // TILE_MAP_LAYER_H