ajout d'effet de post processing et réparation des graines
This commit is contained in:
BIN
entities/plants/assets/sprites/seed_buried_texture.png
Normal file
BIN
entities/plants/assets/sprites/seed_buried_texture.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://do3wxh7k38m7u"
|
||||
path="res://.godot/imported/seed_buried_texture.png-1822d7240070f3b15514c261d06c7402.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/plants/assets/sprites/seed_buried_texture.png"
|
||||
dest_files=["res://.godot/imported/seed_buried_texture.png-1822d7240070f3b15514c261d06c7402.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://bmjjpk4lvijws" path="res://entities/plants/scripts/plant_sprite.gd" id="1_pq8o7"]
|
||||
[ext_resource type="Texture2D" uid="uid://pltmnkqd5ut2" path="res://entities/plants/assets/sprites/seeds/grille_seeds.png" id="3_j6jm5"]
|
||||
[ext_resource type="Texture2D" uid="uid://do3wxh7k38m7u" path="res://entities/plants/assets/sprites/seed_buried_texture.png" id="3_rbgiq"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_wyuub"]
|
||||
atlas = ExtResource("3_j6jm5")
|
||||
@@ -107,11 +108,17 @@ scale = Vector2(0.15, 0.15)
|
||||
|
||||
[node name="PlantedSeed" type="Sprite2D" parent="Sprite" unique_id=1134686525]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, 653.33325)
|
||||
scale = Vector2(1.5, 1.5)
|
||||
texture = SubResource("AtlasTexture_wyuub")
|
||||
region_rect = Rect2(0, -50, 124, 135)
|
||||
region_filter_clip_enabled = true
|
||||
|
||||
[node name="SeedBuriedTexture" type="Sprite2D" parent="Sprite/PlantedSeed" unique_id=2046939355]
|
||||
position = Vector2(4.444448, 31.11118)
|
||||
scale = Vector2(3.1777775, 3.1777775)
|
||||
texture = ExtResource("3_rbgiq")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1793068152]
|
||||
unique_name_in_owner = true
|
||||
libraries/ = SubResource("AnimationLibrary_8eofq")
|
||||
|
||||
File diff suppressed because one or more lines are too long
14
entities/plants/scripts/test_seeds.gd
Normal file
14
entities/plants/scripts/test_seeds.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
@tool
|
||||
extends PlantTextureBuilderInstance
|
||||
|
||||
@export var hash : int = 0 :
|
||||
set(v):
|
||||
hash = v
|
||||
update_seed_sprite()
|
||||
|
||||
func _ready():
|
||||
update_seed_sprite()
|
||||
|
||||
func update_seed_sprite():
|
||||
if is_node_ready():
|
||||
%Sprite2D.texture = build_seed_texture(hash)
|
||||
1
entities/plants/scripts/test_seeds.gd.uid
Normal file
1
entities/plants/scripts/test_seeds.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://txf17lassjod
|
||||
@@ -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
|
||||
|
||||
34
entities/plants/test_seeds.tscn
Normal file
34
entities/plants/test_seeds.tscn
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user