ajout d'effet de post processing et réparation des graines

This commit is contained in:
2026-02-27 00:51:06 +01:00
parent a4662f2797
commit 8b3d5a98e1
19 changed files with 268 additions and 64 deletions

View File

@@ -1,4 +1,5 @@
extends Node
class_name PlantTextureBuilderInstance
const IMAGE_WIDTH := 2048
const IMAGE_HEIGHT := 2048
@@ -75,23 +76,29 @@ func shuffle_weighted(array: Array, weights: Array[int]):
func build_seed_texture(random_seed: int) -> Texture:
rng.seed = random_seed
var texture_set: SeedTextureSet = pick_random(seed_texture_sets)
var seed_image := Image.create(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE, false, Image.FORMAT_RGBA8)
for color_image in texture_set.color_images:
color_image.resize(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE)
var texture_set : SeedTextureSet = pick_random(seed_texture_sets)
var seed_image := Image.create(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE, false, Image.FORMAT_RGBA8)
for color_texture in texture_set.color_textures:
var color_image = color_texture.get_image().duplicate()
color_image.resize(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE)
modulate_image(color_image, pick_random(COLOR_PALETTE))
seed_image.blend_rect(color_image, Rect2i(0, 0, SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE), Vector2i.ZERO)
if texture_set.outline_image:
var outline_image = texture_set.outline_image
outline_image.resize(SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE)
seed_image.blend_rect(outline_image, Rect2i(0, 0, SEED_TEXTURE_SIZE, SEED_TEXTURE_SIZE), Vector2i.ZERO)
seed_image.blend_rect(
color_image,
Rect2i(0,0,SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE),
Vector2i.ZERO
)
if texture_set.outline_texture:
var outline_image = texture_set.outline_texture.get_image().duplicate()
outline_image.resize(SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE)
seed_image.blend_rect(outline_image, Rect2i(0,0,SEED_TEXTURE_SIZE,SEED_TEXTURE_SIZE),Vector2i.ZERO)
if rng.randi() % 2 == 0:
if rng.randi()%2 == 0:
seed_image.flip_x()
return ImageTexture.create_from_image(image)
return ImageTexture.create_from_image(seed_image)
func build_plant_texture(plant_data: PlantData) -> Texture:
rng.seed = plant_data.random_seed