diff options
author | Hop311 <hop3114@gmail.com> | 2023-04-26 00:51:44 +0200 |
---|---|---|
committer | Hop311 <hop3114@gmail.com> | 2023-04-26 00:51:44 +0200 |
commit | 563834e7e6f9ce565bbfd553a0d9ff80a98c677d (patch) | |
tree | fcf86e6fac31430ba537a0d056e97f901ad76dd7 /game/src/GameSession/MapView.gd | |
parent | 50327abf33078c44fef85c62ce3d90e23056fb34 (diff) |
Divide map texture to fit in 16384 GPU dim limit
Diffstat (limited to 'game/src/GameSession/MapView.gd')
-rw-r--r-- | game/src/GameSession/MapView.gd | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/game/src/GameSession/MapView.gd b/game/src/GameSession/MapView.gd index 510d70a..e74ea59 100644 --- a/game/src/GameSession/MapView.gd +++ b/game/src/GameSession/MapView.gd @@ -41,7 +41,6 @@ var _mouse_over_viewport : bool = true var _map_mesh : MapMesh var _map_shader_material : ShaderMaterial var _map_image_size : Vector2 -var _map_province_index_image : Image var _map_province_colour_image : Image var _map_province_colour_texture : ImageTexture var _map_mesh_corner : Vector2 @@ -77,12 +76,15 @@ func _ready(): return _map_shader_material = map_material - # Province index texture - _map_province_index_image = GameSingleton.get_province_index_image() - if _map_province_index_image == null: + # Province index textures + var map_province_index_images := GameSingleton.get_province_index_images() + if map_province_index_images == null or map_province_index_images.is_empty(): push_error("Failed to get province index image!") return - var province_index_texture := ImageTexture.create_from_image(_map_province_index_image) + var province_index_texture := Texture2DArray.new() + if province_index_texture.create_from_images(map_province_index_images) != OK: + push_error("Failed to generate province index texture array!") + return _map_shader_material.set_shader_parameter(_shader_param_province_index, province_index_texture) # Province colour texture |