diff options
author | kobewi <kobewi4e@gmail.com> | 2023-07-31 21:35:17 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2023-09-09 00:56:38 +0200 |
commit | a9f3154da3be6f5808ee00b4a02372a25a3ec26c (patch) | |
tree | 07a9ebdfc2d3cc112e4a345403fd52ec8ec17686 /scene/resources/tile_set.h | |
parent | fc99492d3066098e938449b10e02f8e01d07e2d1 (diff) | |
download | redot-engine-a9f3154da3be6f5808ee00b4a02372a25a3ec26c.tar.gz |
Add per-tile flipping and transposing
Diffstat (limited to 'scene/resources/tile_set.h')
-rw-r--r-- | scene/resources/tile_set.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scene/resources/tile_set.h b/scene/resources/tile_set.h index f053740db1..d500169843 100644 --- a/scene/resources/tile_set.h +++ b/scene/resources/tile_set.h @@ -62,10 +62,10 @@ class TileSetPluginAtlasNavigation; union TileMapCell { struct { - int32_t source_id : 16; - int16_t coord_x : 16; - int16_t coord_y : 16; - int32_t alternative_tile : 16; + int16_t source_id; + int16_t coord_x; + int16_t coord_y; + int16_t alternative_tile; }; uint64_t _u64t; @@ -598,6 +598,12 @@ public: TILE_ANIMATION_MODE_MAX, }; + enum TransformBits { + TRANSFORM_FLIP_H = 1 << 12, + TRANSFORM_FLIP_V = 1 << 13, + TRANSFORM_TRANSPOSE = 1 << 14, + }; + private: struct TileAlternativesData { Vector2i size_in_atlas = Vector2i(1, 1); @@ -736,6 +742,8 @@ public: Rect2i get_tile_texture_region(Vector2i p_atlas_coords, int p_frame = 0) const; bool is_position_in_tile_texture_region(const Vector2i p_atlas_coords, int p_alternative_tile, Vector2 p_position) const; + static int alternative_no_transform(int p_alternative_id); + // Getters for texture and tile region (padded or not) Ref<Texture2D> get_runtime_texture() const; Rect2i get_runtime_tile_texture_region(Vector2i p_atlas_coords, int p_frame = 0) const; |