mirror of
https://github.com/godotengine/godot.git
synced 2024-12-15 10:12:40 +08:00
Merge pull request #87160 from kleonc/tilemap-fix-debug-drawing-truncations-to-ints
Fix some `TileMap` debug drawing truncating to ints
This commit is contained in:
commit
fe76b61743
@ -1869,7 +1869,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_unscaled_draw() {
|
||||
for (int i = 0; i < tile_set_atlas_source->get_tiles_count(); i++) {
|
||||
Vector2i coords = tile_set_atlas_source->get_tile_id(i);
|
||||
Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(coords);
|
||||
Vector2i position = texture_region.get_center() + tile_set_atlas_source->get_tile_data(coords, 0)->get_texture_origin();
|
||||
Vector2 position = ((Rect2)texture_region).get_center() + tile_set_atlas_source->get_tile_data(coords, 0)->get_texture_origin();
|
||||
|
||||
Transform2D xform = tile_atlas_control->get_parent_control()->get_transform();
|
||||
xform.translate_local(position);
|
||||
@ -1892,7 +1892,7 @@ void TileSetAtlasSourceEditor::_tile_atlas_control_unscaled_draw() {
|
||||
continue;
|
||||
}
|
||||
Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(E.tile);
|
||||
Vector2i position = texture_region.get_center() + tile_set_atlas_source->get_tile_data(E.tile, 0)->get_texture_origin();
|
||||
Vector2 position = ((Rect2)texture_region).get_center() + tile_set_atlas_source->get_tile_data(E.tile, 0)->get_texture_origin();
|
||||
|
||||
Transform2D xform = tile_atlas_control->get_parent_control()->get_transform();
|
||||
xform.translate_local(position);
|
||||
|
@ -634,7 +634,7 @@ void TileMapLayer::_rendering_occluders_update_cell(CellData &r_cell_data) {
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
void TileMapLayer::_rendering_draw_cell_debug(const RID &p_canvas_item, const Vector2i &p_quadrant_pos, const CellData &r_cell_data) {
|
||||
void TileMapLayer::_rendering_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data) {
|
||||
const Ref<TileSet> &tile_set = tile_map_node->get_tileset();
|
||||
ERR_FAIL_COND(!tile_set.is_valid());
|
||||
|
||||
@ -898,7 +898,7 @@ void TileMapLayer::_physics_update_cell(CellData &r_cell_data) {
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
void TileMapLayer::_physics_draw_cell_debug(const RID &p_canvas_item, const Vector2i &p_quadrant_pos, const CellData &r_cell_data) {
|
||||
void TileMapLayer::_physics_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data) {
|
||||
// Draw the debug collision shapes.
|
||||
const Ref<TileSet> &tile_set = tile_map_node->get_tileset();
|
||||
ERR_FAIL_COND(!tile_set.is_valid());
|
||||
@ -1117,7 +1117,7 @@ void TileMapLayer::_navigation_update_cell(CellData &r_cell_data) {
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
void TileMapLayer::_navigation_draw_cell_debug(const RID &p_canvas_item, const Vector2i &p_quadrant_pos, const CellData &r_cell_data) {
|
||||
void TileMapLayer::_navigation_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data) {
|
||||
// Draw the debug collision shapes.
|
||||
bool show_navigation = false;
|
||||
switch (tile_map_node->get_navigation_visibility_mode()) {
|
||||
@ -1302,7 +1302,7 @@ void TileMapLayer::_scenes_update_cell(CellData &r_cell_data) {
|
||||
}
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
void TileMapLayer::_scenes_draw_cell_debug(const RID &p_canvas_item, const Vector2i &p_quadrant_pos, const CellData &r_cell_data) {
|
||||
void TileMapLayer::_scenes_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data) {
|
||||
const Ref<TileSet> &tile_set = tile_map_node->get_tileset();
|
||||
ERR_FAIL_COND(!tile_set.is_valid());
|
||||
|
||||
|
@ -300,7 +300,7 @@ private:
|
||||
void _rendering_occluders_clear_cell(CellData &r_cell_data);
|
||||
void _rendering_occluders_update_cell(CellData &r_cell_data);
|
||||
#ifdef DEBUG_ENABLED
|
||||
void _rendering_draw_cell_debug(const RID &p_canvas_item, const Vector2i &p_quadrant_pos, const CellData &r_cell_data);
|
||||
void _rendering_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data);
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
HashMap<RID, Vector2i> bodies_coords; // Mapping for RID to coords.
|
||||
@ -310,7 +310,7 @@ private:
|
||||
void _physics_clear_cell(CellData &r_cell_data);
|
||||
void _physics_update_cell(CellData &r_cell_data);
|
||||
#ifdef DEBUG_ENABLED
|
||||
void _physics_draw_cell_debug(const RID &p_canvas_item, const Vector2i &p_quadrant_pos, const CellData &r_cell_data);
|
||||
void _physics_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data);
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
bool _navigation_was_cleaned_up = false;
|
||||
@ -318,7 +318,7 @@ private:
|
||||
void _navigation_clear_cell(CellData &r_cell_data);
|
||||
void _navigation_update_cell(CellData &r_cell_data);
|
||||
#ifdef DEBUG_ENABLED
|
||||
void _navigation_draw_cell_debug(const RID &p_canvas_item, const Vector2i &p_quadrant_pos, const CellData &r_cell_data);
|
||||
void _navigation_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data);
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
bool _scenes_was_cleaned_up = false;
|
||||
@ -326,7 +326,7 @@ private:
|
||||
void _scenes_clear_cell(CellData &r_cell_data);
|
||||
void _scenes_update_cell(CellData &r_cell_data);
|
||||
#ifdef DEBUG_ENABLED
|
||||
void _scenes_draw_cell_debug(const RID &p_canvas_item, const Vector2i &p_quadrant_pos, const CellData &r_cell_data);
|
||||
void _scenes_draw_cell_debug(const RID &p_canvas_item, const Vector2 &p_quadrant_pos, const CellData &r_cell_data);
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
// Terrains.
|
||||
|
Loading…
Reference in New Issue
Block a user