From aacfcc8e28dcaeb33f65168b7ada1faee22aa256 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 29 Mar 2025 17:43:28 +0100 Subject: [PATCH] =?UTF-8?q?Pas=20d'anti=20aliasing=20et=20voil=C3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- caracters/bob/bob.gdshader | 18 +++++++----------- caracters/bob/bob.tscn | 6 ++++-- caracters/npc.gd | 6 ++---- project.godot | 1 + 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/caracters/bob/bob.gdshader b/caracters/bob/bob.gdshader index c9eefb0..0e4449c 100644 --- a/caracters/bob/bob.gdshader +++ b/caracters/bob/bob.gdshader @@ -1,6 +1,6 @@ shader_type canvas_item; -uniform vec4 line_color : source_color = vec4(1); +uniform vec4 line_color : source_color = vec4(1.0); uniform float line_thickness : hint_range(0, 10) = 1.0; const vec2 OFFSETS[8] = { @@ -9,19 +9,15 @@ const vec2 OFFSETS[8] = { }; void fragment() { - vec2 size = TEXTURE_PIXEL_SIZE * line_thickness / 2.0; - vec4 color = texture(TEXTURE, UV); + vec2 size = TEXTURE_PIXEL_SIZE * line_thickness; + float outline = 1.0; - float inline = 1.0; - float outline = 0.0; for (int i = 0; i < OFFSETS.length(); i++) { - float sample = texture(TEXTURE, UV + size * OFFSETS[i]).a; - outline += sample; - inline *= sample; + outline *= texture(TEXTURE, UV + size * OFFSETS[i]).a; } - outline = min(1.0, outline) - color.a; - inline = (1.0 - inline) * color.a; + outline = 1.0 - outline; - vec4 outlined_result = mix(color, line_color, outline + inline); + vec4 color = texture(TEXTURE, UV); + vec4 outlined_result = mix(color, line_color, outline * color.a); COLOR = mix(color, outlined_result, outlined_result.a); } \ No newline at end of file diff --git a/caracters/bob/bob.tscn b/caracters/bob/bob.tscn index b45b9e6..d9c0281 100644 --- a/caracters/bob/bob.tscn +++ b/caracters/bob/bob.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=18 format=3 uid="uid://bleadp4yrdgj"] +[gd_scene load_steps=19 format=3 uid="uid://bleadp4yrdgj"] [ext_resource type="Script" path="res://caracters/human.gd" id="1_x3vfc"] [ext_resource type="AnimationNodeStateMachine" uid="uid://ddr1ltkievtku" path="res://animations/human/human_state_machine.tres" id="2_86nrf"] @@ -9,6 +9,7 @@ [ext_resource type="Shader" path="res://caracters/bob/bob.gdshader" id="5_tpu8c"] [ext_resource type="PackedScene" uid="uid://07byq4mh8uwv" path="res://caracters/npc_controler.tscn" id="8_uueub"] [ext_resource type="PackedScene" uid="uid://x2asns3kiqwg" path="res://interactable/interaction_zone.tscn" id="9_35f01"] +[ext_resource type="Resource" uid="uid://vg4mssby1i6p" path="res://caracters/bob/bob.dialogue" id="9_d5408"] [ext_resource type="PackedScene" uid="uid://dn10ervwv15oo" path="res://UI/clues/bubble_clue.tscn" id="10_rm4iv"] [ext_resource type="PackedScene" uid="uid://cjm4k0fv7eger" path="res://caracters/human_pathfinder.tscn" id="11_ubech"] @@ -53,7 +54,7 @@ tree_root = SubResource("AnimationNodeBlendTree_iwsa7") advance_expression_base_node = NodePath("..") anim_player = NodePath("../AnimationPlayer") parameters/HumanState/grabing/blend_position = Vector2(0, 0) -parameters/HumanState/idling/blend_position = Vector2(0, 0) +parameters/HumanState/idling/blend_position = Vector2(0.652675, 0.0159453) parameters/HumanState/walking/blend_position = Vector2(0, 0) parameters/TimeScale/scale = 1.0 @@ -82,6 +83,7 @@ rotation = 1.5708 shape = SubResource("CapsuleShape2D_a4vmx") [node name="npcControler" parent="." instance=ExtResource("8_uueub")] +dialogue = ExtResource("9_d5408") [node name="interaction zone" parent="." node_paths=PackedStringArray("clue") instance=ExtResource("9_35f01")] clue = NodePath("../clue") diff --git a/caracters/npc.gd b/caracters/npc.gd index 7b973b0..ccda830 100644 --- a/caracters/npc.gd +++ b/caracters/npc.gd @@ -1,10 +1,8 @@ extends Node - @onready var controled:Human = get_parent() +@export var dialogue : Resource func _on_character_body_2d_start_intracting(interactingWith: Human) -> void: controled.face(interactingWith.global_position) - # ouvre un dialogue - var resource = load("res://caracters/bob/bob.dialogue") - DialogueManager.show_dialogue_balloon(resource, "start") + DialogueManager.show_dialogue_balloon(dialogue, "start") diff --git a/project.godot b/project.godot index 27d6759..970aa0b 100644 --- a/project.godot +++ b/project.godot @@ -89,3 +89,4 @@ textures/canvas_textures/default_texture_filter=0 renderer/rendering_method="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility" textures/vram_compression/import_etc2_astc=true +anti_aliasing/screen_space_roughness_limiter/enabled=false